我有一个索引,我查询一个聚合,而不是立即返回整个聚合,而是希望以大块小块的形式返回它,是否可以在Elastic Search中这样做?
答案 0 :(得分:0)
尝试使用Bucket sort
POST /sales/_search
{
"size": 0,
"aggs" : {
"sales_per_month" : {
"date_histogram" : {
"field" : "date",
"interval" : "month"
},
"aggs": {
"total_sales": {
"sum": {
"field": "price"
}
},
"sales_bucket_sort": {
"bucket_sort": {
"sort": [
{"total_sales": {"order": "desc"}}
],
"size": 3,
"from": 10
}
}
}
}
}
}