Software⏱️ 3 min read📅 2026-06-03

How to Fix: ElasticSearch: Unassigned Shards, how to fix?

ES cluster issue with unassigned shards after node restart.

Quick Answer: Check the shard allocation settings and adjust the number_of_replicas to a lower value. Then, run the command `cluster:force_rebalance` to redistribute the shards.

An Elasticsearch cluster with unassigned shards can be frustrating, especially when it affects data retrieval and indexing. In this guide, we'll walk you through the possible causes of unassigned shards and provide steps to resolve the issue.

Rejoining a node that had previously left the cluster without its assigned shards can lead to this problem. The good news is that we can identify the root cause and take corrective action to fix it.

🛑 Root Causes of the Error

  • The first main reason for unassigned shards occurs when a node rejoins the cluster after a restart or failure, but doesn't pick up its assigned shards. This can happen if the node was previously configured as a data node but is now reconfigured as a master node.
  • An alternative reason for unassigned shards might be related to the Elasticsearch configuration. For example, if the number of replicas is set too low, it may cause some shards to become unassigned.

🚀 How to Resolve This Issue

Reconfigure the node to pick up its assigned shards

  1. Step 1: Step 1: Verify that the node has been reconfigured correctly and is now a data node. Run the command `GET /cluster/health` to check the cluster status.
  2. Step 2: Step 2: Use the Elasticsearch API or Kibana to retrieve the shard assignments for the rejoined node. You can use the `GET /_nodes/_all/shards` endpoint to view the shard allocations.
  3. Step 3: Step 3: Manually pick up the unassigned shards on the reconfigured node by running the command `GET _cluster/nodes/{node_id}/shard_allocation` and then using the `PUT /{index_name}/{shard_id}` endpoint to assign the shard to the node.

Increase the number of replicas

  1. Step 1: Step 1: Verify that the current number of replicas is set correctly. Run the command `GET /cluster/health` to check the cluster status.
  2. Step 2: Step 2: Increase the number of replicas for the affected index by running the command `PUT /{index_name}/_settings` with the following JSON payload: `{"index": {"number_of_replicas": {"value": }}}`.

✨ Wrapping Up

To resolve the issue of unassigned shards, it's essential to identify the root cause and take corrective action. By reconfiguring the node to pick up its assigned shards or increasing the number of replicas, you can ensure that your Elasticsearch cluster operates efficiently and effectively.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions