【发布时间】:2018-06-14 14:59:27
【问题描述】:
我有一个索引,我想从中搜索文本并获取前 100 个结果并执行聚合以从这 100 个结果中检索 uniqueIds 并按它们的 max_value/sum_value 对它们进行排序。目前我正在使用下面的查询,它对大约 10 万个结果执行聚合。但我希望此聚合仅限于我的前 100 个结果
{
"size": 0,
"query": {
"multi_match": {
"query": "game of thrones",
"fields": ["Textfield", "Textfield.shingles^3"]
}
},
"aggs" : {
"Bucketized_Results" : {
"terms" : {
"field" : "uniqueId",
"order": {"max_score": "desc"}
},
"aggs": {
"max_score": {
"max": {
"script": "_score"
}
}
}
}
}
}
【问题讨论】:
标签: elasticsearch aggregation elasticsearch-aggregation