gpt4 book ai didi

elasticsearch - 俄罗斯词霸的搜索结果错误

转载 作者:行者123 更新时间:2023-12-03 02:20:56 25 4
gpt4 key购买 nike

这些分析器设置的索引为products。使用查询стекло进行搜索可返回空结果,但使用查询стеклоы可以很好地进行搜索。

PUT /products
{
"settings": {
"analysis": {
"filter": {
"russian_stop": {
"type": "stop",
"stopwords": "_russian_"
},
"russian_stemmer": {
"type": "stemmer",
"language": "russian"
},
"russian_synonym": {
"type": "synonym",
"synonyms": [
"айфон => iphone",
"хонор => honor"
]
}
},
"analyzer": {
"ru_en": {
"tokenizer": "standard",
"filter": [
"lowercase",
"russian_stop",
"russian_stemmer",
"russian_synonym"
]
}
}
}
}
}

GET /products/_search
{
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "стекло",
"operator": "and",
"analyzer": "ru_en",
"fuzziness": 0,
"fields": [
"name",
"category"
]
}
}
]
}
}
}

最佳答案

将这些映射添加到索引设置

"mappings": {
"properties": {
"name": {
"type": "text",
"analyzer": "ru_en"
}
}
}

关于elasticsearch - 俄罗斯词霸的搜索结果错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62381925/

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