Elasticsearch tries to take advantage of all the available resources by distributing data (index shards) amongst the cluster nodes.
Users might want to influence this data distribution by configuring the
cluster.routing.allocation.total_shards_per_node
system setting to restrict the number of shards that can be hosted on a single
node in the system, regardless of the index.
Various configurations limiting how many shards can be hosted on a single node
can lead to shards being unassigned due to the cluster not having enough nodes to
satisfy the configuration.
In order to fix this follow the next steps: