当前位置: 首页>>代码示例>>Java>>正文


Java GlobalBuilder类代码示例

本文整理汇总了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);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:7,代码来源:AggregationBuilders.java

示例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;
}
 
开发者ID:searchisko,项目名称:searchisko,代码行数:60,代码来源:SearchService.java


注:本文中的org.elasticsearch.search.aggregations.bucket.global.GlobalBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。