Search in sources :

Example 6 with TermsAggregationBuilder

use of org.graylog.shaded.elasticsearch6.org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder in project fess by codelibs.

the class BsElevateWordCA method setTargetRole_Terms.

public void setTargetRole_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda, OperatorCall<BsElevateWordCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "targetRole");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        ElevateWordCA ca = new ElevateWordCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
Also used : TermsAggregationBuilder(org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder) SignificantTermsAggregationBuilder(org.elasticsearch.search.aggregations.bucket.significant.SignificantTermsAggregationBuilder) ElevateWordCA(org.codelibs.fess.es.config.cbean.ca.ElevateWordCA)

Example 7 with TermsAggregationBuilder

use of org.graylog.shaded.elasticsearch6.org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder in project fess by codelibs.

the class BsFileConfigToRoleCA method setFileConfigId_Terms.

public void setFileConfigId_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda, OperatorCall<BsFileConfigToRoleCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "fileConfigId");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        FileConfigToRoleCA ca = new FileConfigToRoleCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
Also used : TermsAggregationBuilder(org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder) SignificantTermsAggregationBuilder(org.elasticsearch.search.aggregations.bucket.significant.SignificantTermsAggregationBuilder) FileConfigToRoleCA(org.codelibs.fess.es.config.cbean.ca.FileConfigToRoleCA)

Example 8 with TermsAggregationBuilder

use of org.graylog.shaded.elasticsearch6.org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder in project fess by codelibs.

the class BsFileConfigToLabelCA method setFileConfigId_Terms.

public void setFileConfigId_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda, OperatorCall<BsFileConfigToLabelCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "fileConfigId");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        FileConfigToLabelCA ca = new FileConfigToLabelCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
Also used : TermsAggregationBuilder(org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder) SignificantTermsAggregationBuilder(org.elasticsearch.search.aggregations.bucket.significant.SignificantTermsAggregationBuilder) FileConfigToLabelCA(org.codelibs.fess.es.config.cbean.ca.FileConfigToLabelCA)

Example 9 with TermsAggregationBuilder

use of org.graylog.shaded.elasticsearch6.org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder in project fess by codelibs.

the class BsSearchFieldLogCA method setValue_Terms.

public void setValue_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda, OperatorCall<BsSearchFieldLogCA> aggsLambda) {
    TermsAggregationBuilder builder = regTermsA(name, "value");
    if (opLambda != null) {
        opLambda.callback(builder);
    }
    if (aggsLambda != null) {
        SearchFieldLogCA ca = new SearchFieldLogCA();
        aggsLambda.callback(ca);
        ca.getAggregationBuilderList().forEach(builder::subAggregation);
    }
}
Also used : TermsAggregationBuilder(org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder) SignificantTermsAggregationBuilder(org.elasticsearch.search.aggregations.bucket.significant.SignificantTermsAggregationBuilder) SearchFieldLogCA(org.codelibs.fess.es.log.cbean.ca.SearchFieldLogCA)

Example 10 with TermsAggregationBuilder

use of org.graylog.shaded.elasticsearch6.org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder in project fess by codelibs.

the class CrawlingInfoHelper method getSessionIdList.

public List<Map<String, String>> getSessionIdList(final FessEsClient fessEsClient) {
    final FessConfig fessConfig = ComponentUtil.getFessConfig();
    return fessEsClient.search(fessConfig.getIndexDocumentSearchIndex(), fessConfig.getIndexDocumentType(), queryRequestBuilder -> {
        queryRequestBuilder.setQuery(QueryBuilders.matchAllQuery());
        final TermsAggregationBuilder termsBuilder = AggregationBuilders.terms(fessConfig.getIndexFieldSegment()).field(fessConfig.getIndexFieldSegment()).size(maxSessionIdsInList).order(Order.term(false));
        queryRequestBuilder.addAggregation(termsBuilder);
        queryRequestBuilder.setPreference(Constants.SEARCH_PREFERENCE_PRIMARY);
        return true;
    }, (queryRequestBuilder, execTime, searchResponse) -> {
        final List<Map<String, String>> sessionIdList = new ArrayList<>();
        searchResponse.ifPresent(response -> {
            final Terms terms = response.getAggregations().get(fessConfig.getIndexFieldSegment());
            for (final Bucket bucket : terms.getBuckets()) {
                final Map<String, String> map = new HashMap<>(2);
                map.put(fessConfig.getIndexFieldSegment(), bucket.getKey().toString());
                map.put(FACET_COUNT_KEY, Long.toString(bucket.getDocCount()));
                sessionIdList.add(map);
            }
        });
        return sessionIdList;
    });
}
Also used : TermsAggregationBuilder(org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder) Bucket(org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ArrayList(java.util.ArrayList) Terms(org.elasticsearch.search.aggregations.bucket.terms.Terms) FessConfig(org.codelibs.fess.mylasta.direction.FessConfig) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Aggregations

TermsAggregationBuilder (org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder)64 SignificantTermsAggregationBuilder (org.elasticsearch.search.aggregations.bucket.significant.SignificantTermsAggregationBuilder)20 SearchResponse (org.elasticsearch.action.search.SearchResponse)14 Terms (org.elasticsearch.search.aggregations.bucket.terms.Terms)14 BoolQueryBuilder (org.elasticsearch.index.query.BoolQueryBuilder)13 Test (org.junit.Test)11 SearchRequestBuilder (org.elasticsearch.action.search.SearchRequestBuilder)8 FilterAggregationBuilder (org.elasticsearch.search.aggregations.bucket.filter.FilterAggregationBuilder)8 SearchSourceBuilder (org.elasticsearch.search.builder.SearchSourceBuilder)8 LinkedList (java.util.LinkedList)7 AggregationBuilder (org.elasticsearch.search.aggregations.AggregationBuilder)6 IncludeExclude (org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude)6 Arrays (java.util.Arrays)4 Map (java.util.Map)4 SearchRequest (org.apache.metron.indexing.dao.search.SearchRequest)4 AbstractAggregationBuilder (org.elasticsearch.search.aggregations.AbstractAggregationBuilder)4 AggregationBuilders (org.elasticsearch.search.aggregations.AggregationBuilders)4 Sum (org.elasticsearch.search.aggregations.metrics.sum.Sum)4 Nullable (javax.annotation.Nullable)3 Bucket (org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket)3