--- title: "无法修改字段名称的index设置 - 如何解决此Elasticsearch异常" date: 2026-02-08 lastmod: 2026-02-08 description: "当尝试修改Elasticsearch中现有字段的index设置时会发生此错误,因为Elasticsearch不支持在字段创建后更改其index设置" tags: ["字段设置", "索引修改", "映射异常", "Murmur3"] summary: " 版本: 6.8-7.9 简而言之,当尝试修改Elasticsearch中现有字段的’index’设置时会发生此错误。这是不允许的,因为Elasticsearch不支持在字段创建后更改其’index’设置。要解决此问题,您可以使用所需设置创建新索引并重新索引数据,或者在现有索引中添加具有正确’index’设置的新字段。记得根据需要更新查询和应用程序以使用新字段或索引。 日志上下文 # 日志"Setting [index] cannot be modified for field [" + name + “]“的类名是 Murmur3FieldMapper.java。我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人参考: // 不再允许调整这些设置;murmur3字段的全部目的是存储哈希 if (node.get("doc_values") != null) { throw new MapperParsingException("Setting [doc_values] cannot be modified for field [" + name + "]"); } if (node.get("index") != null) { throw new MapperParsingException("Setting [index] cannot be modified for field [" + name + "]"); } TypeParsers.parseField(builder; name; node; parserContext); return builder; " --- > **版本:** 6.8-7.9 简而言之,当尝试修改Elasticsearch中现有字段的'index'设置时会发生此错误。这是不允许的,因为Elasticsearch不支持在字段创建后更改其'index'设置。要解决此问题,您可以使用所需设置创建新索引并重新索引数据,或者在现有索引中添加具有正确'index'设置的新字段。记得根据需要更新查询和应用程序以使用新字段或索引。 日志上下文 ----------- 日志"Setting [index] cannot be modified for field [" + name + "]"的类名是[Murmur3FieldMapper.java。](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/)我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人参考: ```java // 不再允许调整这些设置;murmur3字段的全部目的是存储哈希 if (node.get("doc_values") != null) { throw new MapperParsingException("Setting [doc_values] cannot be modified for field [" + name + "]"); } if (node.get("index") != null) { throw new MapperParsingException("Setting [index] cannot be modified for field [" + name + "]"); } TypeParsers.parseField(builder; name; node; parserContext); return builder; ```