﻿---
title: Total number of shards for an index on a single node exceeded
description: Elasticsearch takes advantage of all available resources by distributing data (index shards) among the cluster nodes. You can influence this data distribution...
url: https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/4946/troubleshoot/elasticsearch/increase-shard-limit
products:
  - Elasticsearch
applies_to:
  - Elastic Stack: Generally available in 9.0+
---

# Total number of shards for an index on a single node exceeded
Elasticsearch takes advantage of all available resources by distributing data (index shards) among the cluster nodes.
You can influence this data distribution by configuring the [index.routing.allocation.total_shards_per_node](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/tree/main/reference/elasticsearch/index-settings/total-shards-per-node#total-shards-per-node) dynamic index setting to restrict the maximum number of shards from a single index that can be allocated to a node.
For example, in case of a highly trafficked index, the value can be set to `1`.
Various configurations limiting how many shards an index can have located on one node can lead to shards being unassigned, because the cluster does not have enough nodes to satisfy the index configuration.
To fix this issue, complete the following steps:
1. [Check and adjust the index allocation settings](#adjust-index-allocation-settings) to determine the current value and increase it if needed.
2. [Determine which data tier needs more capacity](#determine-data-tier) to identify the tier where shards need to be allocated.
3. [Resize your deployment](#resize-deployment) to add capacity and accommodate additional shards.


## Check and adjust the index allocation settings

The `index.routing.allocation.total_shards_per_node` setting controls the maximum number of shards that can be collocated on a node in your cluster. When this limit is reached, Elasticsearch cannot assign new shards to that node, leading to unassigned shards in your cluster.
By checking the current value and increasing it, you allow more shards to be collocated on each node, which might resolve the allocation issue without adding more capacity to your cluster.
You can run the following steps using either [API console](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/4946/explore-analyze/query-filter/tools/console) or direct [Elasticsearch API](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/tree/main/reference/elasticsearch/rest-apis) calls.

### Check the current index setting

Use the [get index settings](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-settings) API to inspect the `index.routing.allocation.total_shards_per_node` value for the index with unassigned shards:
```json
```

The response looks like this:
```json
{
  "my-index-000001": {
    "settings": {
      "index.routing.allocation.total_shards_per_node": "1" 
    }
  }
}
```


### Increase the setting

Use the [update index settings](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-settings) API to increase the value for the total number of shards that can be assigned on a node to a higher value that accommodates your workload:
```json

{
  "index" : {
    "routing.allocation.total_shards_per_node" : "2" <1>
  }
}
```


## Determine which data tier needs more capacity

If increasing the index shard limit alone doesn't resolve the issue, or if you want to distribute shards more evenly, you need to identify which [data tier](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/4946/manage-data/lifecycle/data-tiers) requires additional capacity.
Use the [get index settings](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-settings) API to retrieve the configured value for the `index.routing.allocation.include._tier_preference` setting:
```json
```

The response looks like this:
```json
{
  "my-index-000001": {
    "settings": {
      "index.routing.allocation.include._tier_preference": "data_warm,data_hot" 
    }
  }
}
```


## Resize your deployment

After you've identified the tier that needs more capacity, you can resize your deployment to distribute the shard load and allow previously unassigned shards to be allocated.
<applies-switch>
  <applies-item title="{ ess:, ece: }" applies-to="Elastic Cloud Hosted: Generally available, Elastic Cloud Enterprise: Generally available in 4.0+">
    To enable a new tier in your Elastic Cloud Hosted deployment, you edit the deployment topology to add a new data tier.
    1. In Kibana, open your deployment’s navigation menu (placed under the Elastic logo in the upper left corner) and go to **Manage this deployment**.
    2. From the right hand side, click to expand the **Manage** dropdown button and select **Edit deployment** from the list of options.
    3. On the **Edit** page, click on **+ Add Capacity** for the tier you identified you need to enable in your deployment. Choose the desired size and availability zones for the new tier.
    4. Navigate to the bottom of the page and click the **Save** button.
  </applies-item>

  <applies-item title="{ self: }" applies-to="Self-managed Elastic deployments: Generally available in 9.0+">
    [Add more nodes](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/4946/deploy-manage/maintenance/add-and-remove-elasticsearch-nodes) to your Elasticsearch cluster and assign the index’s target tier [node role](/elastic/docs-content/pull/4946/manage-data/lifecycle/data-tiers#configure-data-tiers-on-premise) to the new nodes, by adjusting the configuration in `elasticsearch.yml`.
  </applies-item>

  <applies-item title="{ eck: }" applies-to="Elastic Cloud on Kubernetes: Generally available in 3.0+">
    To increase the disk capacity of data nodes in your Elastic Cloud on Kubernetes cluster, you can either add more data nodes or increase the storage size of existing nodes.**Option 1: Add more data nodes**
    1. Update the `count` field in your data node NodeSet to add more nodes:
       ```yaml
       apiVersion: elasticsearch.k8s.elastic.co/v1
       kind: Elasticsearch
       metadata:
         name: quickstart
       spec:
         version: 9.3.0
         nodeSets:
         - name: data-nodes
           count: 5 
           config:
             node.roles: ["data"]
           volumeClaimTemplates:
           - metadata:
               name: elasticsearch-data
             spec:
               accessModes:
               - ReadWriteOnce
               resources:
                 requests:
                   storage: 100Gi
       ```
    2. Apply the changes:
       ```sh
       kubectl apply -f your-elasticsearch-manifest.yaml
       ```
       ECK automatically creates the new nodes and Elasticsearch will relocate shards to balance the load. You can monitor the progress using:
       ```json
       ```
    **Option 2: Increase storage size of existing nodes**
    1. If your storage class supports [volume expansion](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#expanding-persistent-volumes-claims), you can increase the storage size in the `volumeClaimTemplates`:
       ```yaml
       apiVersion: elasticsearch.k8s.elastic.co/v1
       kind: Elasticsearch
       metadata:
         name: quickstart
       spec:
         version: 9.3.0
         nodeSets:
         - name: data-nodes
           count: 3
           config:
             node.roles: ["data"]
           volumeClaimTemplates:
           - metadata:
               name: elasticsearch-data
             spec:
               accessModes:
               - ReadWriteOnce
               resources:
                 requests:
                   storage: 200Gi 
       ```
    2. Apply the changes. If the volume driver supports `ExpandInUsePersistentVolumes`, the filesystem will be resized online without restarting Elasticsearch. Otherwise, you may need to manually delete the Pods after the resize so they can be recreated with the expanded filesystem.
    For more information, refer to [Update your deployments](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/4946/deploy-manage/deploy/cloud-on-k8s/update-deployments) and [Volume claim templates](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/4946/deploy-manage/deploy/cloud-on-k8s/volume-claim-templates).
  </applies-item>
</applies-switch>

<admonition title="Simplify monitoring with AutoOps">
  AutoOps is a monitoring tool that simplifies cluster management through performance recommendations, resource utilization visibility, and real-time issue detection with resolution paths. Learn more about [AutoOps](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/4946/deploy-manage/monitor/autoops).
</admonition>