本文整理汇总了Java中org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder.size方法的典型用法代码示例。如果您正苦于以下问题:Java TermsAggregationBuilder.size方法的具体用法?Java TermsAggregationBuilder.size怎么用?Java TermsAggregationBuilder.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder
的用法示例。
在下文中一共展示了TermsAggregationBuilder.size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: termsAgg
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; //导入方法依赖的package包/类
private AggregationBuilder termsAgg(MethodField field) throws SqlParseException {
String aggName = gettAggNameFromParamsOrAlias(field);
TermsAggregationBuilder terms = AggregationBuilders.terms(aggName);
String value = null;
for (KVValue kv : field.getParams()) {
value = kv.value.toString();
switch (kv.key.toLowerCase()) {
case "field":
terms.field(value);
break;
case "size":
terms.size(Integer.parseInt(value));
break;
case "shard_size":
terms.shardSize(Integer.parseInt(value));
break;
case "min_doc_count":
terms.minDocCount(Integer.parseInt(value));
break;
case "missing":
terms.missing(value);
break;
case "order":
if ("asc".equalsIgnoreCase(value)) {
terms.order(Terms.Order.term(true));
} else if ("desc".equalsIgnoreCase(value)) {
terms.order(Terms.Order.term(false));
} else {
throw new SqlParseException("order can only support asc/desc " + kv.toString());
}
break;
case "alias":
case "nested":
case "reverse_nested":
case "children":
break;
default:
throw new SqlParseException("terms aggregation err or not define field " + kv.toString());
}
}
return terms;
}
示例2: termsAgg
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; //导入方法依赖的package包/类
private AggregationBuilder termsAgg(MethodField field) throws SqlParseException {
String aggName = gettAggNameFromParamsOrAlias(field);
TermsAggregationBuilder terms = AggregationBuilders.terms(aggName);
String value = null;
for (KVValue kv : field.getParams()) {
value = kv.value.toString();
switch (kv.key.toLowerCase()) {
case "field":
terms.field(value);
break;
case "size":
terms.size(Integer.parseInt(value));
break;
case "shard_size":
terms.shardSize(Integer.parseInt(value));
break;
case "min_doc_count":
terms.minDocCount(Integer.parseInt(value));
break;
case "missing":
terms.missing(value);
break;
case "order":
if ("asc".equalsIgnoreCase(value)) {
terms.order(BucketOrder.key(true));
} else if ("desc".equalsIgnoreCase(value)) {
terms.order(BucketOrder.key(false));
} else {
throw new SqlParseException("order can only support asc/desc " + kv.toString());
}
break;
case "alias":
case "nested":
case "reverse_nested":
case "children":
break;
case "execution_hint":
terms.executionHint(value);
break;
default:
throw new SqlParseException("terms aggregation err or not define field " + kv.toString());
}
}
return terms;
}