Already primary can t move to primary – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-8.9

Briefly, this error occurs when Elasticsearch tries to assign the primary shard role to a node that is already a primary shard. This usually happens due to network partitions or node failures. To resolve this issue, you can try the following: 1) Restart the Elasticsearch cluster to reset the shard allocation. 2) Use the cluster reroute API to manually reallocate the shards. 3) Check the cluster health and ensure all nodes are properly connected. 4) If the issue persists, consider increasing the number of replicas to provide more options for primary shard allocation.

This guide will help you check for common problems that cause the log ” Already primary; can’t move to primary ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: routing, cluster.

Log Context

Log “Already primary; can’t move to primary” class name is We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 * @throws IllegalShardRoutingStateException if shard is already a primary
 public ShardRouting moveActiveReplicaToPrimary() {
 assert active() : "expected an active shard " + this;
 if (primary) {
 throw new IllegalShardRoutingStateException(this; "Already primary; can't move to primary");
 return new ShardRouting(


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?