How to restrict shard and replica to specific node

You can use allocation filtering to do this. However it won't distinguish between primary and replica.

1 Like