--- title: "嵌套对象映射的include_in_root参数无法更新 - 如何解决此Elasticsearch异常" date: 2026-03-08 lastmod: 2026-03-08 description: "Elasticsearch在尝试更新嵌套对象映射的include_in_root参数时抛出异常,该参数一旦设置就不可修改。本文介绍如何解决此问题。" tags: ["嵌套对象", "映射异常", "参数更新"] summary: " 版本: 7.8-7.8 简要地说,当尝试在Elasticsearch中更新嵌套对象映射的[include_in_root]参数时,会发生此错误。该参数一旦设置就是不可变的,无法更新。要解决此问题,您可以使用所需的设置重新创建索引,或者创建一个具有正确设置的新索引,并将数据从旧索引重新索引到新索引。 日志上下文 # 日志 “[include_in_root] 参数无法为嵌套对象映射更新 [” 的类名是 ObjectMapper.java。 我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人使用: throw new MapperException("The [include_in_parent] parameter can't be updated for the nested object mapping [" + name() + "]."); } if (nested().isIncludeInRoot() != mergeWith.nested().isIncludeInRoot()) { throw new MapperException("The [include_in_root] parameter can't be updated for the nested object mapping [" + name() + "]."); } } @Override " --- > **版本:** 7.8-7.8 简要地说,当尝试在Elasticsearch中更新嵌套对象映射的[include_in_root]参数时,会发生此错误。该参数一旦设置就是不可变的,无法更新。要解决此问题,您可以使用所需的设置重新创建索引,或者创建一个具有正确设置的新索引,并将数据从旧索引重新索引到新索引。 日志上下文 ----------- 日志 "[include\_in\_root] 参数无法为嵌套对象映射更新 [" 的类名是 [ObjectMapper.java。](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/) 我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人使用: ```java throw new MapperException("The [include_in_parent] parameter can't be updated for the nested object mapping [" + name() + "]."); } if (nested().isIncludeInRoot() != mergeWith.nested().isIncludeInRoot()) { throw new MapperException("The [include_in_root] parameter can't be updated for the nested object mapping [" + name() + "]."); } } @Override ```