我想使用以下方法聚合我的查询结果:
"aggs": {
"agg1": {
"terms": {
"field": "basket_id_1",
"size":0
},
"aggs": {
"basket_id_2": {
"terms": {
"field": "basket_id_2",
"size":0
},
"aggs": {
"basket_id_3": {
"terms": {
"field": "basket_id_3",
"size":0
}
}
}
}
}
}
}
我如何在 java 中使用 elasticsearch spring 框架来做到这一点?我该调用哪种方法?在哪个物体上?
到目前为止,这是我在 java 中的代码:
NativeSearchQueryBuilder searchQueryNative = new NativeSearchQueryBuilder()
.withIndices(this.getIndex()).withTypes(this.getType());
searchQueryNative.
SearchQuery searchQuery = searchQueryNative.build();
Page<Object> result = this.getElasticsearchTemplate().queryForPage(
searchQuery, Object.class).;