Deleting unassigned shard replicas

I have a 3 node cluster (i2a, i2b and i2c) with a replica factor of 2 (1 primary, 2 copies). We noticed the cluster became yellow, as we have UNASSIGNED shards. Reason is that a copy of the share already exists.
When we look at the shard status, we see the following:

tag-mapping-2.0       9 r STARTED       19 586.8kb   node-master-i2b
tag-mapping-2.0       9 p STARTED       19 707.7kb  node-master-i2a
tag-mapping-2.0       9 r STARTED       19 586.8kb   node-master-i2c
tag-mapping-2.0       9 r UNASSIGNED

We see the same pattern for all the shards: 1 primary, 2 replicas and 1 unassigned.
It seems that we just want to delete the unassigned shard.

I searched online but could not find a way to do this. We tried to restart each service, we tried to close/open the index, but the situation is still the same. We would prefer avoiding adding another node so the unassigned shard gets allocated to it.

What's the recommended way of proceeding? How could we just tell Elastic to ignore this unassigned replica so we can go back to a green state?

Thank you

1 Like

What are the index settings? Is it possible that you have number of replica shards set to 3?

Thank you for your help. The number of replicas is set to 2 (1 primary, 2 replicas)

Just to be sure can you please share the full output of GET tag-mapping-2.0/_settings? It would also be useful to see the output of GET _cat/shards for this index and run the cluster allocation explain API on the unassigned shard.

You were so right! I used the command you provided to pull the index settings and indeed the replica was set to 3. My mistake for not checking.
Thank you very much for your help.