Suspect illegal state trying to move shard from primary mode to replica mode – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 2.3-2.3

Briefly, this error occurs when Elasticsearch attempts to change a shard’s status from primary to replica, which is not a valid operation. This could be due to a bug, a network partition, or a misconfiguration. To resolve this issue, you can try restarting the Elasticsearch node, checking for network issues, or reconfiguring your cluster settings. If the problem persists, you may need to recreate the shard or the entire index.

This guide will help you check for common problems that cause the log ” suspect illegal state: trying to move shard from primary mode to replica mode ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: index and shard.

Log Context

Log “suspect illegal state: trying to move shard from primary mode to replica mode” classname is IndexShard.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

                     "; new " + newRouting);
        }
        try {
            if (currentRouting != null) {
                if (!newRouting.primary() && currentRouting.primary()) {
                    logger.warn("suspect illegal state: trying to move shard from primary mode to replica mode");
                }
                // if its the same routing except for some metadata info; return
                if (currentRouting.equalsIgnoringMetaData(newRouting)) {
                    this.shardRouting = newRouting; // might have a new version
                    return;




 

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?