Total number of shards per node has been reached
Stack ECH ECK ECE Self-Managed
Elasticsearch takes advantage of all available resources by distributing data (index shards) among the cluster nodes.
You 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, because the cluster does not have enough nodes to satisfy the configuration.
To fix this issue, complete the following steps:
In order to get the shards assigned we’ll need to increase the number of shards that can be collocated on a node in the cluster. We’ll achieve this by inspecting the system-wide cluster.routing.allocation.total_shards_per_node cluster setting and increasing the configured value.
Use Kibana
- Log in to the Elastic Cloud console. 
- On the Hosted deployments panel, click the name of your deployment. Note- If the name of your deployment is disabled your Kibana instances might be unhealthy, in which case contact Elastic Support. If your deployment doesn’t include Kibana, all you need to do is enable it first. 
- Open your deployment’s side navigation menu (placed under the Elastic logo in the upper left corner) and go to Dev Tools > Console.   
- Inspect the - cluster.routing.allocation.total_shards_per_nodecluster setting:- GET /_cluster/settings?flat_settings- The response will look like this: - { "persistent": { "cluster.routing.allocation.total_shards_per_node": "300" }, "transient": {} }- Represents the current configured value for the total number of shards that can reside on one node in the system.
 
- Increase the value for the total number of shards that can be assigned on one node to a higher value: - PUT _cluster/settings- { "persistent" : { "cluster.routing.allocation.total_shards_per_node" : 400 } }- The new value for the system-wide total_shards_per_nodeconfiguration is increased from the previous value of300to400. Thetotal_shards_per_nodeconfiguration can also be set tonull, which represents no upper bound with regards to how many shards can be collocated on one node in the system.
 
- The new value for the system-wide 
In order to get the shards assigned you can add more nodes to your Elasticsearch cluster and assign the index’s target tier node role to the new nodes.
To inspect which tier is an index targeting for assignment, use the get index setting API to retrieve the configured value for the index.routing.allocation.include._tier_preference setting:
				GET /my-index-000001/_settings/index.routing.allocation.include._tier_preference?flat_settings
		
	The response will look like this:
{
  "my-index-000001": {
    "settings": {
      "index.routing.allocation.include._tier_preference": "data_warm,data_hot"
    }
  }
}
		
	- Represents a comma separated list of data tier node roles this index is allowed to be allocated on, the first one in the list being the one with the higher priority i.e. the tier the index is targeting. e.g. in this example the tier preference is data_warm,data_hotso the index is targeting thewarmtier and more nodes with thedata_warmrole are needed in the Elasticsearch cluster.
Alternatively, if adding more nodes to the Elasticsearch cluster is not desired, inspecting the system-wide cluster.routing.allocation.total_shards_per_node cluster setting and increasing the configured value:
- Inspect the - cluster.routing.allocation.total_shards_per_nodecluster setting for the index with unassigned shards:- GET /_cluster/settings?flat_settings- The response will look like this: - { "persistent": { "cluster.routing.allocation.total_shards_per_node": "300" }, "transient": {} }- Represents the current configured value for the total number of shards that can reside on one node in the system.
 
- Increase the value for the total number of shards that can be assigned on one node to a higher value: - PUT _cluster/settings- { "persistent" : { "cluster.routing.allocation.total_shards_per_node" : 400 } }- The new value for the system-wide total_shards_per_nodeconfiguration is increased from the previous value of300to400. Thetotal_shards_per_nodeconfiguration can also be set tonull, which represents no upper bound with regards to how many shards can be collocated on one node in the system.
 
- The new value for the system-wide 
Use AutoOps in your Elastic Cloud Hosted, ECE, ECK, or self-managed deployments.
AutoOps is a monitoring tool that simplifies cluster management through performance recommendations, resource utilization visibility, and real-time issue detection with resolution paths. For more information, refer to AutoOps.