﻿---
title: Warning: Not enough nodes to allocate all shard replicas
description: Distributing copies of the data (index shard replicas) on different nodes can parallelize processing requests, speeding up search queries. To achieve...
url: https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/4819/troubleshoot/elasticsearch/increase-tier-capacity
products:
  - Elasticsearch
applies_to:
  - Elastic Stack: Generally available in 9.0+
---

# Warning: Not enough nodes to allocate all shard replicas
Distributing copies of the data (index shard replicas) on different nodes can parallelize processing requests, speeding up search queries. To achieve this, increase the number of replica shards up to the maximum value (total number of nodes minus one), which also protects against hardware failure. If the index has a preferred tier, Elasticsearch will only place the copies of the data for that index on nodes in the target tier.
If a warning is encountered with not enough nodes to allocate all shard replicas, you can influence this behavior by adding more nodes to the cluster (or tier), or by reducing the [`index.number_of_replicas`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/tree/main/reference/elasticsearch/index-settings/index-modules#dynamic-index-number-of-replicas) index setting.
To accomplish this, complete the following steps:
1. [Determine which data tier needs more capacity](#determine-data-tier) to identify the tier where shards need to be allocated.
2. [Resize your deployment](#resize-deployment) to add capacity and accommodate all shard replicas.
3. [Check and adjust the index replicas limit](#adjust-index-replica-limit) to determine the current value and reduce it if needed.


## Determine which data tier needs more capacity

You can run the following step using either [API console](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/4819/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.
To determine which tiers an index's shards can be allocated to, use the [get index setting](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+">
    You can either increase the size per zone to increase the number of nodes in the availability zone(s) you were already using, or increase the number of availability zones.
    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 to your Elasticsearch cluster and assign the index’s target tier [node role](/elastic/docs-content/pull/4819/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+">
    Add more nodes to your Elasticsearch cluster and assign the index’s target tier [node role](/elastic/docs-content/pull/4819/deploy-manage/distributed-architecture/clusters-nodes-shards/node-roles#change-node-role) to the new nodes, by adjusting the [node configuration](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/4819/deploy-manage/deploy/cloud-on-k8s/node-configuration) in the `spec` section of your Elasticsearch resource manifest.
  </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/4819/deploy-manage/monitor/autoops).
</admonition>


## Check and adjust the index replicas limit

If it is not possible to increase capacity by resizing your deployment, you can reduce the number of replicas of your index data. You achieve this by inspecting the [`index.number_of_replicas`](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/tree/main/reference/elasticsearch/index-settings/index-modules#dynamic-index-number-of-replicas) index setting index setting and decreasing the configured value.
1. 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.number_of_replicas` index setting.
   ```json
   ```
   The response looks like this:
   ```json
   {
     "my-index-000001" : {
       "settings" : {
         "index" : {
           "number_of_replicas" : "2" 
         }
       }
     }
   }
   ```
2. Use the [`_cat/nodes`](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cat-nodes) API to find the number of nodes in the target tier:
   ```json
   ```
   The response looks like this, containing one row per node:
   ```json
   himrst
   mv
   himrst
   ```
   You can count the rows containing the letter representing the target tier to know how many nodes you have. See [Query parameters](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cat-nodes) for details. The example above has two rows containing `h`, so there are two nodes in the hot tier.
3. Use the [update index settings](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-settings) API to decrease the value for the total number of replica shards required for this index. As replica shards cannot reside on the same node as primary shards for [high availability](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/4819/deploy-manage/production-guidance/availability-and-resilience), the new value needs to be less than or equal to the number of nodes found above minus one. Since the example above found 2 nodes in the hot tier, the maximum value for `index.number_of_replicas` is 1.
   ```json

   {
     "index" : {
       "number_of_replicas" : 1 <1>
     }
   }
   ```

Reduce the `index.number_of_replicas` index setting.
<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/4819/deploy-manage/monitor/autoops).
</admonition>