﻿---
title: Total shards per node
description: The cluster-level shard allocator tries to spread the shards of a single index across as many nodes as possible. However, depending on how many shards...
url: https://www.elastic.co/elastic/docs-builder/docs/4622/reference/elasticsearch/index-settings/total-shards-per-node
products:
  - Elasticsearch
applies_to:
  - Elastic Stack: Generally available
---

# Total shards per node
<admonition title="Settings supported in Serverless">
  Elastic Cloud Serverless projects [restrict the available Elasticsearch settings](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4622/deploy-manage/deploy/elastic-cloud/differences-from-other-elasticsearch-offerings#elasticsearch-differences-serverless-settings-availability) to a supported subset, identified with a `Serverless` badge next to the setting name. For a complete list of available index settings, refer to the [Serverless index settings list](https://www.elastic.co/elastic/docs-builder/docs/4622/reference/elasticsearch/index-settings/serverless).
</admonition>

The cluster-level shard allocator tries to spread the shards of a single index across as many nodes as possible. However, depending on how many shards and indices you have, and how big they are, it may not always be possible to spread shards evenly.
The following *dynamic* setting allows you to specify a hard limit on the total number of shards from a single index allowed per node:

<definitions>
  <definition term="index.routing.allocation.total_shards_per_node">
    The maximum number of shards (replicas and primaries) that will be allocated to a single node. Defaults to unbounded.
  </definition>
</definitions>


<note>
  To also limit the number of shards a node can have regardless of the index, use the node-level [`cluster.routing.allocation.total_shards_per_node`](/elastic/docs-builder/docs/4622/reference/elasticsearch/configuration-reference/cluster-level-shard-allocation-routing-settings#cluster-routing-allocation-total-shards-per-node) cluster setting. It applies across all indices on a node.
</note>

<warning>
  This setting imposes a hard limit which can result in some shards not being allocated.Use with caution.
</warning>