本文整理匯總了Java中org.elasticsearch.search.aggregations.bucket.global.GlobalBuilder類的典型用法代碼示例。如果您正苦於以下問題:Java GlobalBuilder類的具體用法?Java GlobalBuilder怎麽用?Java GlobalBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GlobalBuilder類屬於org.elasticsearch.search.aggregations.bucket.global包,在下文中一共展示了GlobalBuilder類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: global
import org.elasticsearch.search.aggregations.bucket.global.GlobalBuilder; //導入依賴的package包/類
/**
* Create a new {@link Global} aggregation with the given name.
*/
public static GlobalBuilder global(String name) {
return new GlobalBuilder(name);
}
示例2: createTermsBuilder
import org.elasticsearch.search.aggregations.bucket.global.GlobalBuilder; //導入依賴的package包/類
/**
* Create "terms aggregation" which can be [optionally] nested in "filtered aggregation" if any filters
* are used and always nested in "global filter".
*
* Nesting of aggregations. First comes the global aggregation, first-level nested
* is filter aggregation and second-level nested is terms aggregation.
* <pre>
* {
* "aggs" : {
* "aggregationName" : {
* "global" : {},
* // if any filters from searchFilters apply
* "aggs" : {
* "aggregationName_filter" : {
* "filter" : { _filters_ },
* // buckets
* "aggs" : {
* "aggregationName_buckets" : {
* "terms" : {
* "field" : ... ,
* "size" : ...
* }
* }
* }
* }
* }
* }
* }
* }
* </pre>
*
* @param aggregationName top level name of the aggregation
* @param aggregationField index field the aggregation buckets are calculated for
* @param size terms field size
* @param searchFilters used filters
* @param excluding if true then filters on top of aggregationField are excluded from searchFilters
* @return GlobalBuilder
*/
protected GlobalBuilder createTermsBuilder(String aggregationName, String aggregationField, int size,
Map<String, FilterBuilder> searchFilters, boolean excluding) {
FilterAggregationBuilder fab = null;
if (searchFilters != null && !searchFilters.isEmpty()) {
FilterBuilder[] fb = excluding ? filtersMapToArrayExcluding(searchFilters, aggregationField) :
filtersMapToArray(searchFilters);
if (fb != null && fb.length > 0) {
fab = AggregationBuilders.filter(aggregationName + "_filter");
fab.filter(new AndFilterBuilder(fb));
}
}
TermsBuilder tb = AggregationBuilders.terms(aggregationName+"_buckets").field(aggregationField).size(size);
GlobalBuilder gb = AggregationBuilders.global(aggregationName);
if (fab != null) {
fab.subAggregation(tb);
gb.subAggregation(fab);
} else {
gb.subAggregation(tb);
}
return gb;
}