Indices don t have primary shards – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 8.6-8.9

Briefly, this error occurs when Elasticsearch cannot allocate primary shards to indices, which is crucial for indexing and searching data. This could be due to insufficient disk space, network issues, or incorrect configuration. To resolve this, ensure there’s enough disk space and the cluster is properly networked. Check the shard allocation settings and adjust if necessary. Also, consider increasing the number of primary shards or using the reroute API to manually allocate them. Lastly, ensure the Elasticsearch version is up-to-date to avoid bugs that may cause this issue.

This guide will help you check for common problems that cause the log ” Indices don’t have primary shards ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: shards, indices.

Log Context

Log “Indices don’t have primary shards” class name is SnapshotsService.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 if (entry.getValue().state() == ShardState.MISSING) {
 missing.add(entry.getKey().getIndex().getName());
 }
 }
 if (missing.isEmpty() == false) {
 throw new SnapshotException(snapshot; "Indices don't have primary shards " + missing);
 }
 }
 final var newEntry = SnapshotsInProgress.startedEntry(
 snapshot;
 request.includeGlobalState();

 

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?