不幸的是,我的印象是他只想考虑第一种而没有考虑第二种...
这是我的排序:
"sort": [
{
"properties.pickup_date.from": {
"order": "ASC",
"nested": {
"path": "properties.pickup_date"
}
}
},
{
"_script": {
"type": "number",
"script": {
"source": "if (doc.containsKey('properties.assigned_vehicles')) { return 0; } else { return 1; }"
},
"order": "DESC"
}
}
]
这是我的一部分:
"aggs": {
"criticality_aggs": {
"range": {
"field": "properties.pickup_date.from",
"keyed": true,
"ranges": [
{
"key": "critical",
"to": "now+150m"
},
{
"key": "high",
"from": "now+150m",
"to": "now+7h"
},
{
"key": "average",
"from": "now+7h"
}
]
}
}
我在搜索中发现了这个,但我不明白:https://www.elastic.co/guide/en/elasticsearch/guide/2.x/_sorting.html#_multilevel_sorting
我希望我的数据通过 elasticsearch 这样排序:关键 - 未分配
关键 - 已分配
高 - 未分配
高分配
平均 - 未分配
平均 - 分配
(关键,高和平均是我的批评)