gpt4 book ai didi

elasticsearch - Elasticsearch 中 multi_match 搜索中哪个字段匹配查询?

转载 作者:行者123 更新时间:2023-11-29 02:46:01 25 4
gpt4 key购买 nike

我在 Elasticsearch 中使用 multi_match 查询:

{
"query": {
"multi_match": {
"query": "luk",
"fields": [
"xml_string.autocomplete",
"state"
]
}
},
"size": 10,
"fields": [
"xml_string",
"state"
]
}

效果很好,结果返回预期值:

{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 0.41179964,
"hits": [
{
"_index": "documents",
"_type": "document",
"_id": "11",
"_score": 0.41179964,
"fields": {
"xml_string": "Lukas bla bla bla",
"state": "new"
}
}
]
}
}

我搜索了很多,但我无法找出哪个字段与查询匹配(如果它是 xml_string OR state)

最佳答案

我找到了解决方案:我使用了突出显示功能并且效果很好

这是我的 curl 的样子:

 curl -X GET 'http://xxxxx.com:9200/documents/document/_search?load=false&size=10&pretty' -d '{
"query": {
"multi_match": {
"query": "123",
"fields": ["some_field", "another_field"]
}
},
"highlight": {
"fields": {
"some_field": {},
"another_field": {}
}
},
"size": 10,
"fields": ["field","another_field"]
}'

关于elasticsearch - Elasticsearch 中 multi_match 搜索中哪个字段匹配查询?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18576812/

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