diff --git a/core/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java b/core/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java index 18f08c929ee..22bd4336974 100644 --- a/core/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java +++ b/core/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java @@ -306,7 +306,8 @@ public class RecoveryTarget extends AbstractComponent { try { recoveryStatus.indexShard().performBatchRecovery(request.operations()); } catch (TranslogRecoveryPerformer.BatchOperationException exception) { - if (ExceptionsHelper.unwrapCause(exception) instanceof MapperException == false) { + MapperException mapperException = (MapperException) ExceptionsHelper.unwrap(exception, MapperException.class); + if (mapperException == null) { throw exception; } // in very rare cases a translog replay from primary is processed before a mapping update on this node