# Horizontal scaling of Elasticsearch cluster

**URL:** <https://discuss.elastic.co/t/horizontal-scaling-of-elasticsearch-cluster/352147>\
**Category:** Elasticsearch\
**Created:** [January 31, 2024, 5:50am UTC](https://discuss.elastic.co/t/horizontal-scaling-of-elasticsearch-cluster/352147 "2024-01-31T05:50:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Priyanka\_chauhan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/priyanka_chauhan/32/86146_2.png) [@Priyanka\_chauhan](https://discuss.elastic.co/u/Priyanka_chauhan)\
**Post date:** [January 31, 2024, 5:50am UTC](https://discuss.elastic.co/t/horizontal-scaling-of-elasticsearch-cluster/352147/1 "2024-01-31T05:50:03Z")

</div>

if I have index size of 2tb and node size is 1tb , In that case how index will split on another nodes and if i add new data nodes so how this data can be distribute, it will do automatically? Or I can do it manually. I want horizontal scaling not vertical scaling . So this index will split into another nodes rather than node failure?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [January 31, 2024, 5:53am UTC](https://discuss.elastic.co/t/horizontal-scaling-of-elasticsearch-cluster/352147/2 "2024-01-31T05:53:20Z")

</div>

How many primary and replica shards does this index have? Elasticsearch will automatically redistribute shards if you add nodes, but will not automatically split shards if you do not have enough.

---

<div class="post-metadata">

**Author:** ![Priyanka\_chauhan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/priyanka_chauhan/32/86146_2.png) [@Priyanka\_chauhan](https://discuss.elastic.co/u/Priyanka_chauhan)\
**Post date:** [January 31, 2024, 7:02am UTC](https://discuss.elastic.co/t/horizontal-scaling-of-elasticsearch-cluster/352147/3 "2024-01-31T07:02:43Z")

</div>

if I set 1 primary and 1 replica shard, what happened in this case

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [January 31, 2024, 7:17am UTC](https://discuss.elastic.co/t/horizontal-scaling-of-elasticsearch-cluster/352147/4 "2024-01-31T07:17:44Z")

</div>

If you only have a single index with 2 shards in total the data can not be distributes across more than 2 nodes (one shard per node). In order to scale out you would need to [use the split index API to increase the number of primary shards](https://www.elastic.co/guide/en/elasticsearch/reference/8.12/indices-split-index.html). Given the size of your index this is probably wise anyway as your shards are currently huge.

---

<div class="post-metadata">

**Author:** ![Priyanka\_chauhan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/priyanka_chauhan/32/86146_2.png) [@Priyanka\_chauhan](https://discuss.elastic.co/u/Priyanka_chauhan)\
**Post date:** [February 1, 2024, 12:28pm UTC](https://discuss.elastic.co/t/horizontal-scaling-of-elasticsearch-cluster/352147/5 "2024-02-01T12:28:30Z")

</div>

So If data nodes are full , how to avoid unassigned shards and cluster health also must be green?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [February 1, 2024, 12:33pm UTC](https://discuss.elastic.co/t/horizontal-scaling-of-elasticsearch-cluster/352147/6 "2024-02-01T12:33:19Z")

</div>

If you have a reasonable shard size, e.g. less than 50GB, you just add nodes and there are enough shards so that Elasticsearch can rebalance.

If you only have a couple of exceptionally large shards and you are running out of disk space you will need to split the index. This does unfortunately require a certain amount of free disk space, so may not be possible unless you are able to increase the amount of disk on the nodes.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 29, 2024, 12:33pm UTC](https://discuss.elastic.co/t/horizontal-scaling-of-elasticsearch-cluster/352147/7 "2024-02-29T12:33:58Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
