在 elasticsearch 中,有没有办法使用自定义分数对聚合桶进行排序/排序?
我正在按客户名称分桶。每个客户都有几个订单,其中有一个交货日期字段 (delivdate)。我想根据与当前日期的距离(接近度)对存储桶进行排序。
例如,对交货日期接近今天的客户姓名进行排序。
"aggs": {
"mygroup": {
"terms": {
"field": "customername",
"order" : { "_term" : "asc" }
}
}
}
谢谢
最佳答案
不幸的是,目前不允许使用 scripted_metric
对聚合进行排序。正在跟踪的问题:https://github.com/elastic/elasticsearch/issues/8486
关于javascript - elasticsearch聚合桶排序顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28320062/