One Index is not recovering from the state INITIALIZING and UNASSIGNED

curl -XGET http://localhost:9200/_cat/shards

app-all       1 r INITIALIZING         viepevrat02
app-all       1 p STARTED      85125705    67gb viepevrat01
app-all       0 p RELOCATING   85129005  67.2gb viepevrat01 -> qkcdvYPDTNSc5jmMa6_uFw viepevrat02
app-all       0 r UNASSIGNED

Previously , the state of app-all in was INITIALIZING , but after reading some resolution method to make the cluster to green, I used the below api to make the replica 0 and once it turned green I made it 1 back. Now getting the above status.

curl -XPUT 'localhost:9200/app-all/_settings' -d '
    "index" : {
        "number_of_replicas" : 0

When your cluster is under going recovery/rebalancing, it's possible to have unassigned replica shards. There are cluster settings that allow you to increase the max number of nodes, files that can be "moved" at any given time. So you could potentially increase those settings to kick start the shard assignment.
But if there's a new index being created, you will have unassigned shard again until one of the existing tasks is done.
So it's just the recovery task queue wait time you are seeing.
I personally would just wait for the rebalancing to complete. The unassigned shard will be handled properly next.

If you have no rebalancing going on while having unassigned shards, then you might need to issue "reroute" command to assign the shards manually. That usually means the shard assignment has tried and failed too many times for some reason.

Does the template for that index exist and have you set the replicas to 0?

You are correct. Now I could see the index 'app-all' in one node is still under INITIALIZING Stage and recovery files are getting created which consumes more memory. But in the other node when I checked the health it is started and working as expected. What I did now I just changed the number of replicas to 0 for that particular index. Now the replica shards seems deleted, where the autogenerated recovery files were created . I will try with the reroute command to assign the shards manually. Thanks for the reply

No the replica shards has been deleted when I changed the replica number to 0

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.