elasticsearch - Elasticsearch synomys 错误 - mapper_parsing_exception
问题描述
我正在尝试运行下面的代码,但出现此错误。请帮我修复它。谢谢:
PUT synonyms_hotel
{
"settings": {
"index": {
"analysis": {
"analyzer": {
"synonym_analyzer": {
"tokenizer": "standard",
"filter": [
"lowercase",
"synonym_graph"
]
}
},
"filter": {
"synonym_graph": {
"type": "synonym_graph",
"synonyms": [
"courtyard, marriot"
]
}
}
}
}
},
"mappings": {
"hotel": {
"properties": {
"name": {
"type": "text",
"fields": {
"raw": {
"type": "keyword"
}
}
},
"city": {
"type": "text",
"fields": {
"raw": {
"type": "keyword"
}
}
},
"name_suggest": {
"type": "completion",
"analyzer": "autocomplete",
"search_analyzer": "standard"
}
}
}
}
}
错误:
{
"error" : {
"root_cause" : [
{
"type" : "mapper_parsing_exception",
"reason" : "Root mapping definition has unsupported parameters: [hotel : {properties={name_suggest={search_analyzer=standard, analyzer=autocomplete, type=completion}, city={type=text, fields={raw={type=keyword}}}, name={type=text, fields={raw={type=keyword}}}}}]"
}
],
"type" : "mapper_parsing_exception",
"reason" : "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [hotel : {properties={name_suggest={search_analyzer=standard, analyzer=autocomplete, type=completion}, city={type=text, fields={raw={type=keyword}}}, name={type=text, fields={raw={type=keyword}}}}}]",
"caused_by" : {
"type" : "mapper_parsing_exception",
"reason" : "Root mapping definition has unsupported parameters: [hotel : {properties={name_suggest={search_analyzer=standard, analyzer=autocomplete, type=completion}, city={type=text, fields={raw={type=keyword}}}, name={type=text, fields={raw={type=keyword}}}}}]"
}
},
"status" : 400
}
解决方案
您可能正在使用 Elasticsearch 7+ 并且映射类型已被弃用,因此您只需删除hotel
级别:
PUT synonyms_hotel
{
"settings": {
"index": {
"analysis": {
"analyzer": {
"synonym_analyzer": {
"tokenizer": "standard",
"filter": [
"lowercase",
"synonym_graph"
]
}
},
"filter": {
"synonym_graph": {
"type": "synonym_graph",
"synonyms": [
"courtyard, marriot"
]
}
}
}
}
},
"mappings": {
"properties": { <--- remove hotel here
"name": {
"type": "text",
"fields": {
"raw": {
"type": "keyword"
}
}
},
"city": {
"type": "text",
"fields": {
"raw": {
"type": "keyword"
}
}
},
"name_suggest": {
"type": "completion",
"analyzer": "autocomplete",
"search_analyzer": "standard"
}
}
}
}
推荐阅读
- python - 使用 re.findall 提取 URL 末尾的 id
- jenkins - 有没有更好的方法在不删除现有表的情况下更新雪花数据仓库中的表架构?
- angularjs - How to bystep this $watch infinite loop?
- jquery - jQuery: find elements by word from the text string
- java - 在一个字符串中添加两个数字
- python - 我无法删除空白
- excel - 将数据拉到excel中的工作簿
- jquery - .each 循环根据元素类型和名称进行迭代
- c++ - 出现错误 D8045“无法编译 C 文件
使用 /clr 选项”即使在关闭 CLR 选项后 - java - 无法访问 Spring Boot application.properties