Is there a way to delete unassigned replica and recover using primary shard for a index?

One of my replica is failed to recover due to file system issue and Primary shard is fine. Is there a way we can delete only the failed replica for that shard and recover using the Primary shard.

I don't think there is a way to delete just one replica shard but what I've done in similar situations is to remove the replica from the affected index and then add it back, that will force Elasticsearch to create new, fresh replica shards for the primaries.

In that case, just do

PUT my_index/_settings
{
    "index.number_of_replicas" : 0
}

and a few moments later

PUT my_index/_settings
{
    "index.number_of_replicas" : 1
}

Good luck!

What you ask sounds like the default behaviour: Elasticsearch ignores a failed replica and recovers another replica from the primary by default. I'm curious as to why it's not doing this. Can you share some more information? Logs? Results from the allocation explain API?

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