本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}