Awareness Allocation logic

I am reading the source code of, and try to understand the following piece of code (

final int currentNodeCount = shardPerAttribute.get(node.node().getAttributes().get(awarenessAttribute));
final int maximumNodeCount = (shardCount + numberOfAttributes - 1) / numberOfAttributes; // ceil(shardCount/numberOfAttributes)
if (currentNodeCount > maximumNodeCount) {
            return allocation.decision(Decision.NO, NAME,
                    "there are too many copies of the shard allocated to nodes with attribute [%s], there are [%d] total configured " +
                    "shard copies for this shard id and [%d] total attribute values, expected the allocated shard count per " +
                    "attribute [%d] to be less than or equal to the upper bound of the required number of shards per attribute [%d]",

What is the consideration / purpose to have this check? Does it enforce shards to be almost-evenly stored on each attribute? What happens to unbalanced ES cluster?

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