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


Java TermsAggregationBuilder.size方法代码示例

本文整理汇总了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;
}
 
开发者ID:mazhou,项目名称:es-sql,代码行数:43,代码来源:AggMaker.java

示例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;
}
 
开发者ID:NLPchina,项目名称:elasticsearch-sql,代码行数:46,代码来源:AggMaker.java


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