Mapping updates are not allowed operation – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-8.9

Briefly, this error occurs when an attempt is made to update the mapping of an index that has been set to read-only or has been closed. Elasticsearch does not allow mapping updates in such cases. To resolve this issue, you can either set the index back to read-write mode using the Elasticsearch API or reopen the closed index. Additionally, ensure that the mapping changes are made before the index becomes read-only or gets closed.

This guide will help you check for common problems that cause the log ” mapping updates are not allowed [” + operation + “] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: mapping, recovery, indices.

Log Context

Log “mapping updates are not allowed [” + operation + “]” class name is RecoveryTarget.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 */
 indexShard().updateRetentionLeasesOnReplica(retentionLeases);
 for (Translog.Operation operation : operations) {
 Engine.Result result = indexShard().applyTranslogOperation(operation; Engine.Operation.Origin.PEER_RECOVERY);
 if (result.getResultType() == Engine.Result.Type.MAPPING_UPDATE_REQUIRED) {
 throw new MapperException("mapping updates are not allowed [" + operation + "]");
 }
 if (result.getFailure() != null) {
 if (Assertions.ENABLED && result.getFailure() instanceof MapperException == false) {
 throw new AssertionError("unexpected failure while replicating translog entry"; result.getFailure());
 }

 

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?