gpt4 book ai didi

elasticsearch - 嵌套过滤器在Elasticsearch 1.7中无法正常工作

转载 作者:行者123 更新时间:2023-12-03 02:11:06 26 4
gpt4 key购买 nike

我不能使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!

最佳答案

The nested_path and nested_filter options have been deprecated infavor of the options documented above 6.1.


在下面的搜索查询中尝试一下
{
"query": {
"bool": {
"must": {
"term": {
"parent.raw": "folderName"
}
}
}
},
"sort": [
{
"metadata.value": {
"order": "asc",
"nested": {
"path": "metadata",
"filter": {
"term": {
"metadata.property": "duration"
}
}
}
}
}
]
}

关于elasticsearch - 嵌套过滤器在Elasticsearch 1.7中无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64649365/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com