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


Java InternalAggregations.reduce方法代码示例

本文整理汇总了Java中org.elasticsearch.search.aggregations.InternalAggregations.reduce方法的典型用法代码示例。如果您正苦于以下问题:Java InternalAggregations.reduce方法的具体用法?Java InternalAggregations.reduce怎么用?Java InternalAggregations.reduce使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.search.aggregations.InternalAggregations的用法示例。


在下文中一共展示了InternalAggregations.reduce方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: reduce

import org.elasticsearch.search.aggregations.InternalAggregations; //导入方法依赖的package包/类
public B reduce(List<B> buckets, ReduceContext context) {
    long docCount = 0;
    // For the per term doc count error we add up the errors from the
    // shards that did not respond with the term. To do this we add up
    // the errors from the shards that did respond with the terms and
    // subtract that from the sum of the error from all shards
    long docCountError = 0;
    List<InternalAggregations> aggregationsList = new ArrayList<>(buckets.size());
    for (B bucket : buckets) {
        docCount += bucket.docCount;
        if (docCountError != -1) {
            if (bucket.docCountError == -1) {
                docCountError = -1;
            } else {
                docCountError += bucket.docCountError;
            }
        }
        aggregationsList.add(bucket.aggregations);
    }
    InternalAggregations aggs = InternalAggregations.reduce(aggregationsList, context);
    return newBucket(docCount, aggs, docCountError);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:23,代码来源:InternalTerms.java

示例2: reduce

import org.elasticsearch.search.aggregations.InternalAggregations; //导入方法依赖的package包/类
public Bucket reduce(List<? extends Bucket> buckets, ReduceContext context) {
    long docCount = 0;
    long docCountError = 0;
    List<InternalAggregations> aggregationsList = new ArrayList<>(buckets.size());
    for (Bucket bucket : buckets) {
        docCount += bucket.docCount;
        if (docCountError != -1) {
            if (bucket.docCountError == -1) {
                docCountError = -1;
            } else {
                docCountError += bucket.docCountError;
            }
        }
        aggregationsList.add(bucket.aggregations);
    }
    InternalAggregations aggs = InternalAggregations.reduce(aggregationsList, context);
    return newBucket(docCount, aggs, docCountError);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:19,代码来源:InternalTerms.java

示例3: reduce

import org.elasticsearch.search.aggregations.InternalAggregations; //导入方法依赖的package包/类
public B reduce(List<B> buckets, ReduceContext context) {
    long subsetDf = 0;
    long supersetDf = 0;
    List<InternalAggregations> aggregationsList = new ArrayList<>(buckets.size());
    for (B bucket : buckets) {
        subsetDf += bucket.subsetDf;
        supersetDf += bucket.supersetDf;
        aggregationsList.add(bucket.aggregations);
    }
    InternalAggregations aggs = InternalAggregations.reduce(aggregationsList, context);
    return newBucket(subsetDf, subsetSize, supersetDf, supersetSize, aggs);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:InternalSignificantTerms.java

示例4: reduce

import org.elasticsearch.search.aggregations.InternalAggregations; //导入方法依赖的package包/类
Bucket reduce(List<Bucket> ranges, ReduceContext context) {
    long docCount = 0;
    List<InternalAggregations> aggregationsList = new ArrayList<>(ranges.size());
    for (Bucket range : ranges) {
        docCount += range.docCount;
        aggregationsList.add(range.aggregations);
    }
    final InternalAggregations aggs = InternalAggregations.reduce(aggregationsList, context);
    return getFactory().createBucket(key, from, to, docCount, aggs, keyed, format);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:InternalRange.java

示例5: reduce

import org.elasticsearch.search.aggregations.InternalAggregations; //导入方法依赖的package包/类
public Bucket reduce(List<? extends Bucket> buckets, ReduceContext context) {
    List<InternalAggregations> aggregationsList = new ArrayList<>(buckets.size());
    long docCount = 0;
    for (Bucket bucket : buckets) {
        docCount += bucket.docCount;
        aggregationsList.add(bucket.aggregations);
    }
    final InternalAggregations aggs = InternalAggregations.reduce(aggregationsList, context);
    return new Bucket(geohashAsLong, docCount, aggs);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:InternalGeoHashGrid.java

示例6: reduce

import org.elasticsearch.search.aggregations.InternalAggregations; //导入方法依赖的package包/类
InternalBucket reduce(List<InternalBucket> buckets, ReduceContext context) {
    InternalBucket reduced = null;
    List<InternalAggregations> aggregationsList = new ArrayList<>(buckets.size());
    for (InternalBucket bucket : buckets) {
        if (reduced == null) {
            reduced = new InternalBucket(bucket.key, bucket.docCount, bucket.aggregations);
        } else {
            reduced.docCount += bucket.docCount;
        }
        aggregationsList.add(bucket.aggregations);
    }
    reduced.aggregations = InternalAggregations.reduce(aggregationsList, context);
    return reduced;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:InternalAdjacencyMatrix.java

示例7: reduce

import org.elasticsearch.search.aggregations.InternalAggregations; //导入方法依赖的package包/类
Bucket reduce(List<Bucket> buckets, ReduceContext context) {
    List<InternalAggregations> aggregations = new ArrayList<>(buckets.size());
    long docCount = 0;
    for (Bucket bucket : buckets) {
        docCount += bucket.docCount;
        aggregations.add((InternalAggregations) bucket.getAggregations());
    }
    InternalAggregations aggs = InternalAggregations.reduce(aggregations, context);
    return new InternalHistogram.Bucket(key, docCount, keyed, format, aggs);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:InternalHistogram.java

示例8: reduce

import org.elasticsearch.search.aggregations.InternalAggregations; //导入方法依赖的package包/类
Bucket reduce(List<Bucket> buckets, ReduceContext context) {
    List<InternalAggregations> aggregations = new ArrayList<>(buckets.size());
    long docCount = 0;
    for (Bucket bucket : buckets) {
        docCount += bucket.docCount;
        aggregations.add((InternalAggregations) bucket.getAggregations());
    }
    InternalAggregations aggs = InternalAggregations.reduce(aggregations, context);
    return new InternalDateHistogram.Bucket(key, docCount, keyed, format, aggs);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:InternalDateHistogram.java

示例9: reduce

import org.elasticsearch.search.aggregations.InternalAggregations; //导入方法依赖的package包/类
InternalBucket reduce(List<InternalBucket> buckets, ReduceContext context) {
    InternalBucket reduced = null;
    List<InternalAggregations> aggregationsList = new ArrayList<>(buckets.size());
    for (InternalBucket bucket : buckets) {
        if (reduced == null) {
            reduced = new InternalBucket(bucket.key, bucket.docCount, bucket.aggregations, bucket.keyed);
        } else {
            reduced.docCount += bucket.docCount;
        }
        aggregationsList.add(bucket.aggregations);
    }
    reduced.aggregations = InternalAggregations.reduce(aggregationsList, context);
    return reduced;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:InternalFilters.java

示例10: reduceAggs

import org.elasticsearch.search.aggregations.InternalAggregations; //导入方法依赖的package包/类
private InternalAggregations reduceAggs(List<InternalAggregations> aggregationsList,
                                        List<SiblingPipelineAggregator> pipelineAggregators, ReduceContext reduceContext) {
    InternalAggregations aggregations = InternalAggregations.reduce(aggregationsList, reduceContext);
    if (pipelineAggregators != null) {
        List<InternalAggregation> newAggs = StreamSupport.stream(aggregations.spliterator(), false)
            .map((p) -> (InternalAggregation) p)
            .collect(Collectors.toList());
        for (SiblingPipelineAggregator pipelineAggregator : pipelineAggregators) {
            InternalAggregation newAgg = pipelineAggregator.doReduce(new InternalAggregations(newAggs), reduceContext);
            newAggs.add(newAgg);
        }
        return new InternalAggregations(newAggs);
    }
    return aggregations;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:SearchPhaseController.java

示例11: reduce

import org.elasticsearch.search.aggregations.InternalAggregations; //导入方法依赖的package包/类
public Bucket reduce(List<? extends Bucket> buckets, ReduceContext context) {
    long subsetDf = 0;
    long supersetDf = 0;
    List<InternalAggregations> aggregationsList = new ArrayList<>(buckets.size());
    for (Bucket bucket : buckets) {
        subsetDf += bucket.subsetDf;
        supersetDf += bucket.supersetDf;
        aggregationsList.add(bucket.aggregations);
    }
    InternalAggregations aggs = InternalAggregations.reduce(aggregationsList, context);
    return newBucket(subsetDf, subsetSize, supersetDf, supersetSize, aggs);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:13,代码来源:InternalSignificantTerms.java

示例12: reduce

import org.elasticsearch.search.aggregations.InternalAggregations; //导入方法依赖的package包/类
Bucket reduce(List<Bucket> ranges, ReduceContext context) {
    long docCount = 0;
    List<InternalAggregations> aggregationsList = new ArrayList<>(ranges.size());
    for (Bucket range : ranges) {
        docCount += range.docCount;
        aggregationsList.add(range.aggregations);
    }
    final InternalAggregations aggs = InternalAggregations.reduce(aggregationsList, context);
    return getFactory().createBucket(key, from, to, docCount, aggs, keyed, formatter);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:11,代码来源:InternalRange.java

示例13: reduce

import org.elasticsearch.search.aggregations.InternalAggregations; //导入方法依赖的package包/类
<B extends Bucket> B reduce(List<B> buckets, ReduceContext context) {
    List<InternalAggregations> aggregations = new ArrayList<>(buckets.size());
    long docCount = 0;
    for (Bucket bucket : buckets) {
        docCount += bucket.docCount;
        aggregations.add((InternalAggregations) bucket.getAggregations());
    }
    InternalAggregations aggs = InternalAggregations.reduce(aggregations, context);
    return (B) getFactory().createBucket(key, docCount, aggs, keyed, formatter);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:11,代码来源:InternalHistogram.java

示例14: reduce

import org.elasticsearch.search.aggregations.InternalAggregations; //导入方法依赖的package包/类
Bucket reduce(List<Bucket> buckets, ReduceContext context) {
    Bucket reduced = null;
    List<InternalAggregations> aggregationsList = new ArrayList<>(buckets.size());
    for (Bucket bucket : buckets) {
        if (reduced == null) {
            reduced = new Bucket(bucket.key, bucket.docCount, bucket.aggregations, bucket.keyed);
        } else {
            reduced.docCount += bucket.docCount;
        }
        aggregationsList.add(bucket.aggregations);
    }
    reduced.aggregations = InternalAggregations.reduce(aggregationsList, context);
    return reduced;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:15,代码来源:InternalFilters.java


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