📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

版本: 6.8-7.7

简而言之,当您在索引创建后尝试更新索引映射中某个类型的属性时,会出现此错误。Elasticsearch不允许对现有字段进行某些更改,例如更改数据类型或为文本字段启用"fielddata"选项。要解决此问题,您可以使用正确的映射重新索引数据,或者创建一个具有正确映射的新索引并将数据重新索引到新索引中。另外,您可以使用多字段(multi-field)来添加字段的分析版本。

日志上下文 #

日志"Can’t update attribute for type [" + path + “] in index mapping"的类名是 ObjectMapper.java。我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入了解上下文的人参考:

final ObjectMapper mergeIntoObjectMapper = (ObjectMapper) mergeIntoMapper;
 final ObjectMapper mergeWithObjectMapper = (ObjectMapper) mergeWithMapper;  if (mergeIntoObjectMapper.isEnabled() != mergeWithObjectMapper.isEnabled()) {
 final String path = mergeWith.fullPath() + "." + mergeWithObjectMapper.simpleName() + ".enabled";
 throw new MapperException("Can't update attribute for type [" + path + "] in index mapping");
 }
 }
 }  @Override