我试图使用elasticdump
将映射加载到弹性搜索。完整的文件如下所示。从文档来看,它“应该有效”。尽管如此,我还是发现了一个错误:
Fri, 19 Aug 2022 21:04:48 GMT | Error Emitted => {"root_cause":[{"type":"mapper_parsing_exception","reason":"Failed to parse mapping: analyzer [my_lc_analyzer] has not been configured in mappings"}],
"type":"mapper_parsing_exception","reason":"Failed to parse mapping: analyzer [my_lc_analyzer] has not been configured in mappings","caused_by":{"type":"illegal_argument_exception","reason":"analyzer [my_lc_analyzer] has not been configured in mappings"}}
完整的映射文件是:
{
"ngrams": {
"settings": {
"analysis": {
"analyzer": {
"my_lc_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"asciifolding"
]
}
}
}
},
"mappings": {
"properties": {
"canvas_id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"document_id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"text": {
"type": "text",
"analyzer": "my_lc_analyzer"
}
}
}
}
}
我在web中找到了一些例子,其中settings
键在其中有一个额外的级别,index
。我也试过了,没有运气。
我想我错过了一些愚蠢的细节,但找不到。提前感谢
发布于 2022-08-19 22:15:27
也许关键的"ngram“就是问题所在。
PUT my-index
{
"settings": {
"analysis": {
"analyzer": {
"my_lc_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"asciifolding"
]
}
}
}
},
"mappings": {
"properties": {
"canvas_id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"document_id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"text": {
"type": "text",
"analyzer": "my_lc_analyzer"
}
}
}
}
发布于 2022-08-21 19:25:58
当我在最初的问题上发表时,它可能被大多数读者忽视了。我正在使用elasticdump
来转储和恢复数据库。
我的主要错误是编辑elasticdump
生成的转储并添加settings
部分来描述分析器。我没有阅读elasticdump
文档就这样做了,在我的头脑中,有一个帖子来创建索引和相应的设置是有意义的。
然而,情况并非如此。elasticdump
区分了data
、settings
、analyzers
、mappings
等。因此,必须执行analyzers
类型的导出,这就是导入期间必须提供的内容(具有特定的analyzers
类型)。
虽然我认为elasticdump
可能有一个更干净的界面,但我解决了我的问题,导出了analyzers
,并在mappings
信息之前导入了它。
https://stackoverflow.com/questions/73422282
复制相似问题