org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder Java Examples

The following examples show how to use org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BsWebConfigCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setIncludedDocUrls_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsWebConfigCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "includedDocUrls");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        WebConfigCA ca = new WebConfigCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #2
Source File: BsWebConfigCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setExcludedDocUrls_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsWebConfigCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "excludedDocUrls");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        WebConfigCA ca = new WebConfigCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #3
Source File: HistogramAggregationMain.java    From elasticsearch-pool with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws IOException {
        RestHighLevelClient client = HighLevelClient.getInstance();
        try{
            HistogramAggregationBuilder histogramAggregationBuilder = AggregationBuilders.histogram("utm_histogram");
            histogramAggregationBuilder.field("utm");//设置直方图针对的字段
            histogramAggregationBuilder.interval(1000);//直方图每个分组对应的范围
            histogramAggregationBuilder.order(BucketOrder.aggregation("_key",true));//分组key的排序
//            histogramAggregationBuilder.minDocCount(0);//对于每个分组最少具有多少条数据,少于这个设置,则该分组不显示
//            histogramAggregationBuilder.extendedBounds(0,8000);//设置分组区间的下线和上线,只有当min_doc_count为0时有效

            TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms("top_cmd");
            aggregationBuilder.field("cmd");
            aggregationBuilder.size(3);
            aggregationBuilder.subAggregation(histogramAggregationBuilder);

            SearchRequest searchRequest = new SearchRequest("serverlog_20180710");//限定index
            searchRequest.types("log");//限定type

            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
            searchSourceBuilder.aggregation(aggregationBuilder);
            searchRequest.source(searchSourceBuilder);

            SearchResponse searchResponse = client.search(searchRequest);
            System.out.println(searchResponse);

        }finally{
            HighLevelClient.close();
        }
    }
 
Example #4
Source File: BsScheduledJobCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setUpdatedBy_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsScheduledJobCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "updatedBy");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        ScheduledJobCA ca = new ScheduledJobCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #5
Source File: BsDataConfigCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setHandlerScript_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsDataConfigCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "handlerScript");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        DataConfigCA ca = new DataConfigCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #6
Source File: BsJobLogCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setScriptResult_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsJobLogCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "scriptResult");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        JobLogCA ca = new JobLogCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #7
Source File: BsAccessTokenCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setCreatedBy_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsAccessTokenCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "createdBy");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        AccessTokenCA ca = new AccessTokenCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #8
Source File: BsFileConfigCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setPermissions_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsFileConfigCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "permissions");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        FileConfigCA ca = new FileConfigCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #9
Source File: BsCrawlingInfoParamCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setCrawlingInfoId_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsCrawlingInfoParamCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "crawlingInfoId");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        CrawlingInfoParamCA ca = new CrawlingInfoParamCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #10
Source File: BsFileConfigCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setPaths_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda, OperatorCall<BsFileConfigCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "paths");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        FileConfigCA ca = new FileConfigCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #11
Source File: BsFailureUrlCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setConfigId_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsFailureUrlCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "configId");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        FailureUrlCA ca = new FailureUrlCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #12
Source File: BsLabelTypeCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setUpdatedBy_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsLabelTypeCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "updatedBy");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        LabelTypeCA ca = new LabelTypeCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #13
Source File: MetricsQueryEs7DAO.java    From skywalking with Apache License 2.0 5 votes vote down vote up
protected void functionAggregation(Function function, TermsAggregationBuilder parentAggBuilder, String valueCName) {
    switch (function) {
        case Avg:
            parentAggBuilder.subAggregation(AggregationBuilders.avg(valueCName).field(valueCName));
            break;
        case Sum:
            parentAggBuilder.subAggregation(AggregationBuilders.sum(valueCName).field(valueCName));
            break;
        default:
            parentAggBuilder.subAggregation(AggregationBuilders.avg(valueCName).field(valueCName));
            break;
    }
}
 
Example #14
Source File: BsWebConfigCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setConfigParameter_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsWebConfigCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "configParameter");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        WebConfigCA ca = new WebConfigCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #15
Source File: BsBadWordCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setUpdatedBy_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda, OperatorCall<BsBadWordCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "updatedBy");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        BadWordCA ca = new BadWordCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #16
Source File: BsClickLogCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setDocId_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda, OperatorCall<BsClickLogCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "docId");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        ClickLogCA ca = new ClickLogCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #17
Source File: BsElevateWordCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setReading_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsElevateWordCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "reading");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        ElevateWordCA ca = new ElevateWordCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #18
Source File: BsSearchLogCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setVirtualHost_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsSearchLogCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "virtualHost");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        SearchLogCA ca = new SearchLogCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #19
Source File: BsFileConfigCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setVirtualHosts_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsFileConfigCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "virtualHosts");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        FileConfigCA ca = new FileConfigCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #20
Source File: BsThumbnailQueueCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setPath_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsThumbnailQueueCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "path");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        ThumbnailQueueCA ca = new ThumbnailQueueCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #21
Source File: BsSearchLogCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setSearchWord_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsSearchLogCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "searchWord");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        SearchLogCA ca = new SearchLogCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #22
Source File: BsClickLogCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setUserSessionId_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsClickLogCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "userSessionId");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        ClickLogCA ca = new ClickLogCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #23
Source File: BsRequestHeaderCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setUpdatedBy_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsRequestHeaderCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "updatedBy");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        RequestHeaderCA ca = new RequestHeaderCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #24
Source File: BsAccessTokenCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setName_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda, OperatorCall<BsAccessTokenCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "name");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        AccessTokenCA ca = new AccessTokenCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #25
Source File: BsWebConfigCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setUserAgent_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsWebConfigCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "userAgent");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        WebConfigCA ca = new WebConfigCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #26
Source File: BsWebConfigCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setUrls_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda, OperatorCall<BsWebConfigCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "urls");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        WebConfigCA ca = new WebConfigCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #27
Source File: BsSearchLogCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setHitCountRelation_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsSearchLogCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "hitCountRelation");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        SearchLogCA ca = new SearchLogCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #28
Source File: BsSearchLogCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setLanguages_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsSearchLogCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "languages");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        SearchLogCA ca = new SearchLogCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #29
Source File: BsScheduledJobCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setScriptData_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsScheduledJobCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "scriptData");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        ScheduledJobCA ca = new ScheduledJobCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
 
Example #30
Source File: BsLabelTypeCA.java    From fess with Apache License 2.0 5 votes vote down vote up
public void setCreatedBy_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
        OperatorCall<BsLabelTypeCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "createdBy");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        LabelTypeCA ca = new LabelTypeCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}