Block Mapping Updates

Do Elasticsearch gives an option to block mapping updates for a while and re enable them afterwards.

Usecase:
While doing rolling upgrade, due to incoming writes I am getting mapping updates not allowed exception. So if I can temporarily block mapping updates during rolling upgrade that would help.

For replication:

  • Launch a data-node with ES7.
  • Added an index named syn.
  • Added few documents inside it.
  • Launched a ES8 node in same cluster.
  • Put replica 1 for syn index

Then do following:

curl --location --request PUT 'localhost:9200/syn/_settings' \
--header 'Content-Type: application/json' \
--data '{
    "index": {
        "number_of_replicas": 0
    }
}'

curl --location --request PUT 'localhost:9200/syn/_settings' \
--header 'Content-Type: application/json' \
--data '{
    "index": {
        "number_of_replicas": 1
    }
}'

curl --location --request PUT 'localhost:9200/syn/_doc/123' \
--header 'Content-Type: application/json' \
--data '{
    "uMId": "123",
    "snSt": {
        "a1": 50
    }
}'

Can someone please help here?

Hello,

Please wait at least 24h before bumping a post.

It is not clear what your issue is, please share the log error you got.

Here are the error log:

[2024-09-06T18:54:07,877][INFO ][o.e.i.m.MapperService    ] [data-2] [syn] reloading search analyzers
[2024-09-06T18:54:07,958][WARN ][o.e.i.c.IndicesClusterStateService] [data-2] [syn][0] marking and sending shard failed due to [failed recovery]
org.elasticsearch.indices.recovery.RecoveryFailedException: [syn][0]: Recovery failed from {data-3}{2pV-fXuKTMatkocWjYN7rA}{t19T7jw0TiaFqwrvCnMwUQ}{data-3}{127.0.0.1}{127.0.0.1:9305}{d}{7.17.6}{6000099-7170699}{xpack.installed=true, transform.node=false} into {data-2}{lD17rEysTM6ZquK-Y36fnA}{8N1koGtuQUmVxGmi4u0hOw}{data-2}{127.0.0.1}{127.0.0.1:9304}{d}{8.11.1}{7000099-8500003}{ml.config_version=11.0.0, xpack.installed=true, transform.config_version=10.0.0}
	at org.elasticsearch.indices.recovery.PeerRecoveryTargetService$RecoveryResponseHandler.handleException(PeerRecoveryTargetService.java:836) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleException(TransportService.java:1421) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.transport.InboundHandler.doHandleException(InboundHandler.java:475) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.transport.InboundHandler$3.doRun(InboundHandler.java:467) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:983) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26) ~[elasticsearch-8.11.1-3.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
	at java.lang.Thread.run(Thread.java:840) ~[?:?]
Caused by: org.elasticsearch.transport.RemoteTransportException: [data-3][127.0.0.1:9305][internal:index/shard/recovery/start_recovery]
Caused by: org.elasticsearch.index.engine.RecoveryEngineException: Phase[2] failed to send/replay operations
	at org.elasticsearch.indices.recovery.RecoverySourceHandler$OperationBatchSender.handleError(RecoverySourceHandler.java:1219) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.indices.recovery.RecoverySourceHandler$OperationBatchSender.handleError(RecoverySourceHandler.java:1136) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.indices.recovery.MultiChunkTransfer.handleItems(MultiChunkTransfer.java:108) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.indices.recovery.MultiChunkTransfer.access$000(MultiChunkTransfer.java:48) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.indices.recovery.MultiChunkTransfer$1.write(MultiChunkTransfer.java:72) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.common.util.concurrent.AsyncIOProcessor.processList(AsyncIOProcessor.java:97) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.common.util.concurrent.AsyncIOProcessor.drainAndProcessAndRelease(AsyncIOProcessor.java:85) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.common.util.concurrent.AsyncIOProcessor.put(AsyncIOProcessor.java:73) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.indices.recovery.MultiChunkTransfer.addItem(MultiChunkTransfer.java:83) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.indices.recovery.MultiChunkTransfer.lambda$handleItems$4(MultiChunkTransfer.java:125) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.action.ActionListener$1.onFailure(ActionListener.java:144) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.action.ActionListener$Delegating.onFailure(ActionListener.java:66) ~[?:?]
	at org.elasticsearch.action.ActionListener$Delegating.onFailure(ActionListener.java:66) ~[?:?]
	at org.elasticsearch.action.ActionListener$Delegating.onFailure(ActionListener.java:66) ~[?:?]
	at org.elasticsearch.action.ActionListener$RunBeforeActionListener.onFailure(ActionListener.java:399) ~[?:?]
	at org.elasticsearch.action.support.RetryableAction$RetryingListener.onFinalFailure(RetryableAction.java:185) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.action.support.RetryableAction$RetryingListener.onFailure(RetryableAction.java:177) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.action.ActionListener$Delegating.onFailure(ActionListener.java:66) ~[?:?]
	at org.elasticsearch.action.ActionListener$RunBeforeActionListener.onFailure(ActionListener.java:399) ~[?:?]
	at org.elasticsearch.action.ActionListenerResponseHandler.handleException(ActionListenerResponseHandler.java:48) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleException(TransportService.java:1481) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleException(TransportService.java:1481) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.transport.InboundHandler.lambda$handleException$3(InboundHandler.java:368) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:718) ~[elasticsearch-8.11.1-3.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
	at java.lang.Thread.run(Thread.java:840) ~[?:?]
Caused by: org.elasticsearch.transport.RemoteTransportException: [data-2][127.0.0.1:9304][internal:index/shard/recovery/translog_ops]
Caused by: org.elasticsearch.index.mapper.MapperException: mapping updates are not allowed [Index{id='1', seqNo=0, primaryTerm=1, version=1, autoGeneratedIdTimestamp=-1}]
	at org.elasticsearch.indices.recovery.RecoveryTarget.lambda$indexTranslogOperations$4(RecoveryTarget.java:463) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.action.ActionListener.completeWith(ActionListener.java:299) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.indices.recovery.RecoveryTarget.indexTranslogOperations(RecoveryTarget.java:436) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.indices.recovery.PeerRecoveryTargetService$TranslogOperationsRequestHandler.performTranslogOps(PeerRecoveryTargetService.java:589) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.indices.recovery.PeerRecoveryTargetService$TranslogOperationsRequestHandler.handleRequest(PeerRecoveryTargetService.java:543) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.indices.recovery.PeerRecoveryTargetService$TranslogOperationsRequestHandler.handleRequest(PeerRecoveryTargetService.java:535) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.indices.recovery.PeerRecoveryTargetService$RecoveryRequestHandler.messageReceived(PeerRecoveryTargetService.java:622) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.indices.recovery.PeerRecoveryTargetService$RecoveryRequestHandler.messageReceived(PeerRecoveryTargetService.java:609) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:75) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.transport.InboundHandler.doHandleRequest(InboundHandler.java:288) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.transport.InboundHandler$1.doRun(InboundHandler.java:301) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:983) ~[elasticsearch-8.11.1-3.jar:?]
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26) ~[elasticsearch-8.11.1-3.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
	at java.lang.Thread.run(Thread.java:840) ~[?:?]