• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java InternalAggregations类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: PercolateShardResponse

import org.elasticsearch.search.aggregations.InternalAggregations; //导入依赖的package包/类
public PercolateShardResponse(BytesRef[] matches, List<Map<String, HighlightField>> hls, long count, float[] scores, PercolateContext context, ShardId shardId) {
    super(shardId);
    this.matches = matches;
    this.hls = hls;
    this.count = count;
    this.scores = scores;
    this.percolatorTypeId = context.percolatorTypeId;
    this.requestedSize = context.size();
    QuerySearchResult result = context.queryResult();
    if (result != null) {
        if (result.aggregations() != null) {
            this.aggregations = (InternalAggregations) result.aggregations();
        }
        this.pipelineAggregators = result.pipelineAggregators();
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:17,代码来源:PercolateShardResponse.java


示例2: reduce

import org.elasticsearch.search.aggregations.InternalAggregations; //导入依赖的package包/类
@Override
public InternalAggregation reduce(InternalAggregation aggregation, ReduceContext reduceContext) {
    MultiBucketsAggregation histo = (MultiBucketsAggregation) aggregation;
    List<? extends Bucket> buckets = histo.getBuckets();
    HistogramFactory factory = (HistogramFactory) histo;

    List<Bucket> newBuckets = new ArrayList<>();
    double sum = 0;
    for (Bucket bucket : buckets) {
        Double thisBucketValue = resolveBucketValue(histo, bucket, bucketsPaths()[0], GapPolicy.INSERT_ZEROS);
        sum += thisBucketValue;
        List<InternalAggregation> aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false).map((p) -> {
            return (InternalAggregation) p;
        }).collect(Collectors.toList());
        aggs.add(new InternalSimpleValue(name(), sum, formatter, new ArrayList<PipelineAggregator>(), metaData()));
        Bucket newBucket = factory.createBucket(factory.getKey(bucket), bucket.getDocCount(), new InternalAggregations(aggs));
        newBuckets.add(newBucket);
    }
    return factory.createAggregation(newBuckets);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:CumulativeSumPipelineAggregator.java


示例3: ReducedQueryPhase

import org.elasticsearch.search.aggregations.InternalAggregations; //导入依赖的package包/类
ReducedQueryPhase(long totalHits, long fetchHits, float maxScore, boolean timedOut, Boolean terminatedEarly,
                         QuerySearchResult oneResult, Suggest suggest, InternalAggregations aggregations,
                         SearchProfileShardResults shardResults, int numReducePhases) {
    if (numReducePhases <= 0) {
        throw new IllegalArgumentException("at least one reduce phase must have been applied but was: " + numReducePhases);
    }
    this.totalHits = totalHits;
    this.fetchHits = fetchHits;
    if (Float.isInfinite(maxScore)) {
        this.maxScore = Float.NaN;
    } else {
        this.maxScore = maxScore;
    }
    this.timedOut = timedOut;
    this.terminatedEarly = terminatedEarly;
    this.oneResult = oneResult;
    this.suggest = suggest;
    this.aggregations = aggregations;
    this.shardResults = shardResults;
    this.numReducePhases = numReducePhases;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:22,代码来源:SearchPhaseController.java


示例4: 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


示例5: testConsumerConcurrently

import org.elasticsearch.search.aggregations.InternalAggregations; //导入依赖的package包/类
public void testConsumerConcurrently() throws InterruptedException {
    int expectedNumResults = randomIntBetween(1, 100);
    int bufferSize = randomIntBetween(2, 200);

    SearchRequest request = new SearchRequest();
    request.source(new SearchSourceBuilder().aggregation(AggregationBuilders.avg("foo")));
    request.setBatchedReduceSize(bufferSize);
    InitialSearchPhase.SearchPhaseResults<QuerySearchResultProvider> consumer =
        searchPhaseController.newSearchPhaseResults(request, expectedNumResults);
    AtomicInteger max = new AtomicInteger();
    CountDownLatch latch = new CountDownLatch(expectedNumResults);
    for (int i = 0; i < expectedNumResults; i++) {
        int id = i;
        Thread t = new Thread(() -> {
            int number = randomIntBetween(1, 1000);
            max.updateAndGet(prev -> Math.max(prev, number));
            QuerySearchResult result = new QuerySearchResult(id, new SearchShardTarget("node", new Index("a", "b"), id));
            result.topDocs(new TopDocs(id, new ScoreDoc[0], 0.0F), new DocValueFormat[0]);
            InternalAggregations aggs = new InternalAggregations(Arrays.asList(new InternalMax("test", (double) number,
                DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap())));
            result.aggregations(aggs);
            consumer.consumeResult(id, result);
            latch.countDown();

        });
        t.start();
    }
    latch.await();
    SearchPhaseController.ReducedQueryPhase reduce = consumer.reduce();
    InternalMax internalMax = (InternalMax) reduce.aggregations.asList().get(0);
    assertEquals(max.get(), internalMax.getValue(), 0.0D);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:33,代码来源:SearchPhaseControllerTests.java


示例6: 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


示例7: Bucket

import org.elasticsearch.search.aggregations.InternalAggregations; //导入依赖的package包/类
public Bucket(DocValueFormat format, boolean keyed, String key, BytesRef from, BytesRef to,
        long docCount, InternalAggregations aggregations) {
    this.format = format;
    this.keyed = keyed;
    this.key = key;
    this.from = from;
    this.to = to;
    this.docCount = docCount;
    this.aggregations = aggregations;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:InternalBinaryRange.java


示例8: Bucket

import org.elasticsearch.search.aggregations.InternalAggregations; //导入依赖的package包/类
public Bucket(String key, double from, double to, long docCount, InternalAggregations aggregations, boolean keyed,
        DocValueFormat formatter) {
    this(keyed, formatter);
    this.key = key != null ? key : generateKey(from, to, formatter);
    this.from = from;
    this.to = to;
    this.docCount = docCount;
    this.aggregations = aggregations;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:InternalRange.java


示例9: 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


示例10: InternalSearchResponse

import org.elasticsearch.search.aggregations.InternalAggregations; //导入依赖的package包/类
public InternalSearchResponse(InternalSearchHits hits, InternalAggregations aggregations, Suggest suggest,
                              InternalProfileShardResults profileResults, boolean timedOut, Boolean terminatedEarly) {
    this.hits = hits;
    this.aggregations = aggregations;
    this.suggest = suggest;
    this.profileResults = profileResults;
    this.timedOut = timedOut;
    this.terminatedEarly = terminatedEarly;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:10,代码来源:InternalSearchResponse.java


示例11: 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:baidu,项目名称:Elasticsearch,代码行数:11,代码来源:InternalGeoHashGrid.java


示例12: Bucket

import org.elasticsearch.search.aggregations.InternalAggregations; //导入依赖的package包/类
public Bucket(long key, long docCount, boolean keyed, ValueFormatter formatter, Factory factory,
        InternalAggregations aggregations) {
    this(keyed, formatter, factory);
    this.key = key;
    this.docCount = docCount;
    this.aggregations = aggregations;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:8,代码来源:InternalHistogram.java


示例13: Bucket

import org.elasticsearch.search.aggregations.InternalAggregations; //导入依赖的package包/类
/**
 * Read from a stream.
 */
protected Bucket(StreamInput in, DocValueFormat formatter, boolean showDocCountError) throws IOException {
    this.showDocCountError = showDocCountError;
    this.format = formatter;
    docCount = in.readVLong();
    docCountError = -1;
    if (showDocCountError) {
        docCountError = in.readLong();
    }
    aggregations = InternalAggregations.readAggregations(in);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:InternalTerms.java


示例14: readFrom

import org.elasticsearch.search.aggregations.InternalAggregations; //导入依赖的package包/类
@Override
public void readFrom(StreamInput in) throws IOException {
    termBytes = in.readBytesRef();
    subsetDf = in.readVLong();
    supersetDf = in.readVLong();
    score = in.readDouble();
    aggregations = InternalAggregations.readAggregations(in);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:9,代码来源:SignificantStringTerms.java


示例15: readFrom

import org.elasticsearch.search.aggregations.InternalAggregations; //导入依赖的package包/类
@Override
public void readFrom(StreamInput in) throws IOException {
    subsetDf = in.readVLong();
    supersetDf = in.readVLong();
    term = in.readLong();
    score = in.readDouble();
    aggregations = InternalAggregations.readAggregations(in);

}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:10,代码来源:SignificantLongTerms.java


示例16: 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


示例17: readFrom

import org.elasticsearch.search.aggregations.InternalAggregations; //导入依赖的package包/类
@Override
public void readFrom(StreamInput in) throws IOException {
    hits = SearchHits.readSearchHits(in);
    if (in.readBoolean()) {
        aggregations = InternalAggregations.readAggregations(in);
    }
    if (in.readBoolean()) {
        suggest = Suggest.readSuggest(in);
    }
    timedOut = in.readBoolean();
    terminatedEarly = in.readOptionalBoolean();
    profileResults = in.readOptionalWriteable(SearchProfileShardResults::new);
    numReducePhases = in.readVInt();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:InternalSearchResponse.java


示例18: EmptyBucketInfo

import org.elasticsearch.search.aggregations.InternalAggregations; //导入依赖的package包/类
EmptyBucketInfo(double interval, double offset, double minBound, double maxBound, InternalAggregations subAggregations) {
    this.interval = interval;
    this.offset = offset;
    this.minBound = minBound;
    this.maxBound = maxBound;
    this.subAggregations = subAggregations;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:InternalHistogram.java


示例19: Bucket

import org.elasticsearch.search.aggregations.InternalAggregations; //导入依赖的package包/类
public Bucket(long key, long docCount, boolean keyed, DocValueFormat format,
        InternalAggregations aggregations) {
    this.format = format;
    this.keyed = keyed;
    this.key = key;
    this.docCount = docCount;
    this.aggregations = aggregations;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:InternalDateHistogram.java


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AlipayTradeWapPayRequest类代码示例发布时间:2022-05-22
下一篇:
Java RequestContextAwareTag类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap