--- title: "无法修改字段名称的 doc_values 设置 - 如何解决此 Elasticsearch 异常" date: 2026-02-02 lastmod: 2026-02-02 description: "在 Elasticsearch 中尝试修改现有字段的 doc_values 设置时出现的错误解决方案。doc_values 用于排序、聚合和脚本,一旦字段创建后无法更改此设置。" tags: ["字段映射", "doc_values", "索引管理", "异常处理"] summary: " 版本: 6.8-7.9 简而言之,当尝试在 Elasticsearch 中修改现有字段的 [doc_values] 设置时,会发生此错误。Doc_values 用于排序、聚合和脚本中。一旦字段使用了特定的 doc_values 设置创建,就无法再更改。要解决此问题,您可以创建一个具有所需设置的新索引并重新索引数据。或者,您可以向现有索引添加一个具有正确设置的新字段,然后将数据迁移到新字段。 日志上下文 # 日志 “Setting [doc_values] cannot be modified for field [” + name + “]” 的类名是 Murmur3FieldMapper.java. 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入了解上下文的人使用: throws MapperParsingException { Builder builder = new Builder(name); // 调整这些设置不再允许;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 + "]"); } " --- > **版本:** 6.8-7.9 简而言之,当尝试在 Elasticsearch 中修改现有字段的 [doc_values] 设置时,会发生此错误。Doc_values 用于排序、聚合和脚本中。一旦字段使用了特定的 doc_values 设置创建,就无法再更改。要解决此问题,您可以创建一个具有所需设置的新索引并重新索引数据。或者,您可以向现有索引添加一个具有正确设置的新字段,然后将数据迁移到新字段。 日志上下文 ----------- 日志 "Setting [doc\_values] cannot be modified for field [" + name + "]" 的类名是 [Murmur3FieldMapper.java.](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/) 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入了解上下文的人使用: ```java throws MapperParsingException { Builder builder = new Builder(name); // 调整这些设置不再允许;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 + "]"); } ```