gpt4 book ai didi

elasticsearch - 试图在elasticsearch中添加映射

转载 作者:行者123 更新时间:2023-12-02 23:02:43 24 4
gpt4 key购买 nike

我试图在我的 flex 搜索索引中添加analyzermapping,但是出现此错误;
[Error: MapperParsingException[mapping [product]]; nested: MapperParsingException[Analyzer [synonym] not found for field [name]];
我的索引名称产品,然后输入product.my设置-

{
"settings": {
"products": {
"analysis":{
"analyzer":{
"synonym":{
"tokenizer": "my_ngram",
"filter":[
"synonym"
]
}
},
"tokenizer" : {
"my_ngram" : {
"type" : "nGram",
"min_gram" : "2",
"max_gram" : "3",
"token_chars": [ "letter", "digit" ]
}
},
"filter":{
"synonym": {
"type": "synonym",
"synonyms_path": "synonyms.txt",
"ignore_case": "true"
}
}
}
}
},
"mappings":{
"product":{
"_all":{
"enabled": true,
},
"properties":{
"name":{
"type": "string",
"index": "analyzed",
"analyzer": "synonym"
}
}
}
}
}

我正在使用最新版本的 flex 搜索。

最佳答案

假设synonyms.txt存在,我认为这可以解决您的问题:

{
"settings": {
"analysis": {
"analyzer": {
"synonym": {
"tokenizer": "my_ngram",
"filter": [
"synonym"
]
}
},
"tokenizer": {
"my_ngram": {
"type": "nGram",
"min_gram": "2",
"max_gram": "3",
"token_chars": [
"letter",
"digit"
]
}
},
"filter": {
"synonym": {
"type": "synonym",
"synonyms_path": "synonyms.txt",
"ignore_case": "true"
}
}
}
},
"mappings": {
"product": {
"_all": {
"enabled": true
},
"properties": {
"name": {
"type": "string",
"index": "analyzed",
"analyzer": "synonym"
}
}
}
}
}

您不需要 "products"中的 "settings"条目。

关于elasticsearch - 试图在elasticsearch中添加映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30145443/

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