我无法使nested_filter排序正常工作。 我有这样的映射-
"metadata": {
"type": "nested",
"include_in_parent": true,
"properties": {
"property": {
"type": "string",
"index" : "not_analyzed",
"include_in_parent" : false,
"include_in_all" : false
},
"type": {
"type": "string",
"index": "not_analyzed"
},
"value": {
"type": "string",
"fields": {
"lower_case_sort": {
"type": "string",
"analyzer": "case_insensitive_sort"
}
}
}
}
},
因此,每个文件都具有元数据,其属性为“ duration”,值的持续时间值例如为50.300。 这里有我要查询的查询,但是它不返回结果是升序还是降序,它是随机的。
"query": {
"bool": {
"must": {
"term" : {
"parent.raw": "folderName"
}
}
}
},
"size": 50,
"from": 0,
"sort": {
"metadata.value": {
"order":"desc",
"nested_filter": {
"term": { "metadata.property":"duration" }
}
}
}
}
What could be the issue?
Thank you!
答案 0 :(得分:0)
kotlin docs选项在以下位置已被弃用 赞成6.1以上所述的选项。
在下面的搜索查询中尝试一下
{
"query": {
"bool": {
"must": {
"term": {
"parent.raw": "folderName"
}
}
}
},
"sort": [
{
"metadata.value": {
"order": "asc",
"nested": {
"path": "metadata",
"filter": {
"term": {
"metadata.property": "duration"
}
}
}
}
}
]
}