Segregate Replicas

Is there a way we can segregate all replica shards on a separate node and all primary shard on a separate node?

No, you can not do that. The primaries and replicas do largely the same amount of work so I do not see the point in trying to control that.

What problem are you trying to solve? What are you looking to achieve with this?

When locally rolling upgrading the cluster I once upgraded the node having primary shard first and the replica shard remained unassigned due to version issue.

But vice versa works fine. So I was wondering is there a way to protect this is production.

deciders": [
-{
"decider": "node_version",
"decision": "NO",
"explanation": "cannot allocate replica shard to a node with version [7.17.6] since this is older than the primary version [8.11.1]"
}
]

How many nodes do you have in the cluster?

Did the nodes run exactly the same version of Elasticsearch before the upgrade?

yes, there were three data nodes

all three were at 7.17.6. They were holding only one index with 1 primary and 2 replica shard.

You would need to finish the rolling upgrade.

What you shared means that a new index was created on the node running version 8.11.1, and the replicas of this indice cannot be allocate on nodes where the version is lower than 8.11.1.

So you need to have another node on version 8.11.1 for the replicas to be allocated.

An index created on a lower version can have a replica allocated on a node with a higher version, but the opposite is not possible.

2 Likes