當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。