The include in root parameter can t be updated on a nested object mapping – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.9-8.9

Briefly, this error occurs when you try to update the [include_in_root] parameter on a nested object mapping in Elasticsearch. This parameter is immutable once set and cannot be changed. To resolve this issue, you can either recreate the index with the correct settings or create a new index with the desired settings and reindex the data from the old index to the new one. Always ensure to plan your index structure carefully to avoid such issues.

This guide will help you check for common problems that cause the log ” the [include_in_root] parameter can’t be updated on a nested object mapping ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: mapping, index.

Log Context

Log “the [include_in_root] parameter can’t be updated on a nested object mapping” class name is NestedObjectMapper.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 } else {
 if (includeInParent.value() != mergeWithObject.includeInParent.value()) {
 throw new MapperException("the [include_in_parent] parameter can't be updated on a nested object mapping");
 }
 if (includeInRoot.value() != mergeWithObject.includeInRoot.value()) {
 throw new MapperException("the [include_in_root] parameter can't be updated on a nested object mapping");
 }
 }
 if (parentBuilderContext instanceof NestedMapperBuilderContext nc) {
 if (nc.parentIncludedInRoot && toMerge.includeInParent.value()) {
 toMerge.includeInRoot = Explicit.IMPLICIT_FALSE;

 

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?