当我按字段进行聚合时,我也会进行subAggregation 并且我希望 ES 将它所拥有的topHits
全部返回给我。TopHits
但是,如果我将 size 指定为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();
而且我没有与 key 聚合的桶"aggregation"
。