gpt4 book ai didi

elasticsearch - 如何使用同义词模糊搜索?

转载 作者:行者123 更新时间:2023-11-29 02:57:36 26 4
gpt4 key购买 nike

在我将同义词文件添加到索引后,模糊性停止工作。好像,不可能同时使用它们。 我的查询:

 "query": {
"dis_max": {
"queries": [{
"multi_match": {
"query": $('#searchterm').val(),
"fields": ["search_1"],
"fuzziness": "AUTO",
"operator": "and",
"max_expansions": 1
}},
{ "match": { "search_2": $('#searchterm').val() }}
]
}
}

映射:

"mappings": {
"objs":{
"properties": {
"o":{
"type": "string"
},
"loc":{
"type":"geo_point"
},
"search_1":{
"type": "string",
"analyzer": "synonym"
},
"search_2":{
"type": "string",
"analyzer": "synonym"
}
}
}

最佳答案

我刚刚遇到了同样的问题,看起来你不能混合使用它们,有人已经为此打开了一个 github 问题:https://github.com/elastic/elasticsearch/issues/25518该问题已关闭,他们更新了文档: https://github.com/elastic/elasticsearch/blob/master/docs/reference/query-dsl/match-query.asciidoc

这是有趣的部分:

Note that fuzzy matching is not applied to terms with synonyms, as under the hood these terms are expanded to a special synonym query that blends term frequencies, which does not support fuzzy expansion.

关于elasticsearch - 如何使用同义词模糊搜索?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40911744/

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