ElasticSearch TopHits聚合大小

时间:2016-08-23 09:04:01

标签: elasticsearch elasticsearch-aggregation

当我按字段进行聚合时,我也会进行topHits subAggregation,我希望ES将所有TopHits归还给我。但是,如果我将大小指定为Integer.MAX_VALUE,它就不会返回任何内容。为什么呢?

SearchResponse aggregationResponse = transportClient.prepareSearch(indexAndType[0]).setTypes(indexAndType[1])
            .setQuery(queryBuilder)
            .addAggregation(AggregationBuilders.terms("aggregation").field(aggregateField).size(size)
                    .subAggregation(AggregationBuilders.topHits("hits").setSize(Integer.MAX_VALUE).addSort(SortBuilders.fieldSort("createdDate").order(SortOrder.ASC)))
                    .subAggregation(AggregationBuilders.count("totalCount"))).execute().actionGet();

我没有与密钥"aggregation"聚合的桶。

0 个答案:

没有答案