# Total\_shards\_per\_node on an index pattern instead of an simple index

**URL:** <https://discuss.elastic.co/t/total-shards-per-node-on-an-index-pattern-instead-of-an-simple-index/343869>\
**Category:** Elasticsearch\
**Created:** [September 26, 2023, 11:56am UTC](https://discuss.elastic.co/t/total-shards-per-node-on-an-index-pattern-instead-of-an-simple-index/343869 "2023-09-26T11:56:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guillaume\_Soustrade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guillaume_soustrade/32/121785_2.png) [@Guillaume\_Soustrade](https://discuss.elastic.co/u/Guillaume_Soustrade)\
**Post date:** [September 26, 2023, 11:56am UTC](https://discuss.elastic.co/t/total-shards-per-node-on-an-index-pattern-instead-of-an-simple-index/343869/1 "2023-09-26T11:56:26Z")

</div>

Hello,

I'm looking for a way to limit the number of shards per nodes on a group of index. Is it possible, may be by using index patterns ?

My situation is :

- I have a set of 14 indexes with 12 shards for each
- We have 10 nodes
- I need those 14 indexes to be spread as flat as possible on the nodes, meaning 16-17 shards by nodes. However we have many other indexes in the stack, and elasticsearch sometimes changes the shards repartition for my 14 indexes (after a node falling, or because we lower the load on those 14 indexes, etc.).
- Therefore I would love to be able to set something like

```auto
  "my-14-indexes-pattern*": {
    "settings": {
      "index.routing.allocation.total_shards_per_node": "17" 
    }

```

Would you have an idea to share ?  
Thank you !

---

<div class="post-metadata">

**Author:** ![vincenbr](https://avatars.discourse-cdn.com/v4/letter/v/8edcca/32.png) [@vincenbr](https://discuss.elastic.co/u/vincenbr)\
**Post date:** [September 27, 2023, 10:44pm UTC](https://discuss.elastic.co/t/total-shards-per-node-on-an-index-pattern-instead-of-an-simple-index/343869/2 "2023-09-27T22:44:44Z")

</div>

Hello,  
no, `total_shards_per_node` is an index level setting, you cannot assign a specific value to a group of indices. You have to deal with individual index and set it to 2 (for instance) in order to avoid hotspots.  
Be aware that this is a hard limit to the number of shards (primary+replica) of these indices that each data node will accept.  
Out of curiosity, why 12 shards per index ? are they only primaries or does it include replica ?

---

<div class="post-metadata">

**Author:** ![Guillaume\_Soustrade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guillaume_soustrade/32/121785_2.png) [@Guillaume\_Soustrade](https://discuss.elastic.co/u/Guillaume_Soustrade)\
**Post date:** [September 28, 2023, 11:05am UTC](https://discuss.elastic.co/t/total-shards-per-node-on-an-index-pattern-instead-of-an-simple-index/343869/3 "2023-09-28T11:05:38Z")

</div>

Hello Vincent, thank you for your answer !

The thing is that the limit of 2 / index allows hotspots of 28 shards and only that destroys my performances.  
I don't quite understand why ES rebalancing choses to create hotspot while my indexes are (normally) solicited in a homogeneous way. And a proof for that is that as soon as a hotspot appears, the node's latency is 3 to 4 times greater than the other nodes latencies.

We have only primaries for those indexes and 12 shards makes each shard being 50Go and this repartitions seems optimal for our performances 🙂

---

<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:** [October 26, 2023, 11:06am UTC](https://discuss.elastic.co/t/total-shards-per-node-on-an-index-pattern-instead-of-an-simple-index/343869/4 "2023-10-26T11:06:28Z")

</div>

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