Unassigned shards with reason "ElasticSearch can allocate shards"

We have recently upgraded our cluster to ES 8.12.2. We are observing unassigned shards and on further looking cluster allocation explain API we could see that can_allocate="yes" and allocate_explanation "Elasticsearch can allocate the shard."

It has set of available nodes which it can allocate to but it is not able to move replica shards to them.

+1 I am also facing same issues

At a guess, try setting cluster.routing.allocation.allow_rebalance: always. This will be the default from 8.16 onwards, see Always allow rebalancing by default by DaveCTurner · Pull Request #111015 · elastic/elasticsearch · GitHub.

Even after cluster.routing.allocation.allow_rebalance: always setting, shards gets unassigned and on cluster allocation explain it says can_allocate="yes" and allocate_explanation "Elasticsearch can allocate the shard."

Could you share the full output of GET _cluster/allocation/explain and GET _internal/desired_balance?

not able to paste the full output, is there any location where I can paste?

https://gist.github.com is usually a good choice.

pls check if you can access https://github.com/mukularora89-dev/ES8_Issue

I cannot access that, it says Page not found.