此映射在 ES 2.X 中有效,现在在 ES 5 中出现异常:
{
"type1":{
"properties":{
"name":{
"type":"multi_field",
"fields":{
"name":{
"type":"string",
"index_analyzer":"standard",
"index":"analyzed",
"store":"no",
"search_analyzer":"standard"
},
"name_autocomplete":{
"type":"string",
"index_analyzer":"autocomplete",
"index":"analyzed",
"store":"no",
"search_analyzer":"standard"
}
}
}
}
}
异常(exception)情况是:
没有在字段 [name] 上声明的类型 [multi_field] 的处理程序
有人有想法吗?谢谢! ;)
最佳答案
multi-field 在 ES 1.x 中被弃用并在 ES 5.x 中被完全移除。
现在通过使用 fields 支持多字段您可以这样指定:
{
"type1":{
"properties":{
"name":{
"type":"text",
"analyzer":"standard",
"index":"analyzed",
"store":"no",
"search_analyzer":"standard"
"fields": {
"autocomplete":{
"type":"text",
"analyzer":"autocomplete",
"index":"analyzed",
"store":"no",
"search_analyzer":"standard"
}
}
}
}
}
}
关于java - Elasticsearch 5 : MapperParserException with multi_field,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40301061/