我想对条款查询返回的所有存储桶的doc_counts求和。我将Jest Client用于Spring Data Elasticsearch。
BoolQueryBuilder boolQueryBuilder =
QueryBuilders.boolQuery().must(matchAllQuery());
SearchSourceBuilder searchBuilder = SearchSourceBuilder
.searchSource()
.size(100)
.query(boolQueryBuilder)
.aggregation(
AggregationBuilders
.terms("item_sum")
.field("itemId")
);
Search search = new Search.Builder(searchBuilder.toString())
.addIndex("orders")
.build();
try {
SearchResult result = jestClient.execute(search);
TermsAggregation aggregation = result.getAggregations().getTermsAggregation("item_sum");
} catch (IOException e) {
e.printStackTrace();
}
我想汇总itemId唯一的所有项目,然后对其文档计数求和。但是当我执行上面的代码时,它只给我前10条记录。但是我想对索引中存在的所有记录执行此查询。