作者:风流逍遥快活_936 | 来源:互联网 | 2023-02-01 15:53
在Elasticsearch中,有没有办法检查结果排序的字段?我想要类似于内部命中的排序条款.
想象一下,您的文档有这种形式:
{"numerals" : [ // nested
{"key": "point", "value": 30},
{"key": "points", "value": 200},
{"key": "score", "value": 20},
{"key": "scores", "value": 40}
]
}
并按以下方式对结果进行排序:
{"numerals.value": {
"nested_path": "numerals",
"nested_filter": {
"match": {
"numerals.key": "score"}}}}
现在我不知道如何知道结果实际排序的字段:它可能scores
在本文档中,但可能score
在其他文档中?有两个问题 - 1.您不能使用内部命中或突出显示嵌套字段. - 2.即使你可以,如果有多个匹配的候选人,它也无法解决问题.