use of org.graylog.shaded.elasticsearch7.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);
}
}
use of org.graylog.shaded.elasticsearch7.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);
}
}
use of org.graylog.shaded.elasticsearch7.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);
}
}
use of org.graylog.shaded.elasticsearch7.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);
}
}
use of org.graylog.shaded.elasticsearch7.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;
});
}
Aggregations