当我按字段进行聚合时,我也会进行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"
聚合的桶。