# Way tooooo many shards

**URL:** https://discuss.elastic.co/t/way-tooooo-many-shards/135809
**Category:** Elasticsearch
**Created:** [June 13, 2018, 11:42pm UTC](https://discuss.elastic.co/t/way-tooooo-many-shards/135809 "2018-06-13T23:42:12Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![tsangdl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsangdl/32/12835_2.png) [@tsangdl](https://discuss.elastic.co/u/tsangdl)
#### Post date: [June 13, 2018, 11:42pm UTC](https://discuss.elastic.co/t/way-tooooo-many-shards/135809/1 "2018-06-13T23:42:12Z")

</div>

Hi,

I have been re-architecting my elastic cluster from a wee fledgling to this:  
2 coordinating nodes  
3 master nodes  
12 data nodes

In the process, I seem to have become the proud owner of 170 shards per index ! ... and at \> 4000 indices, that's a lotta shards baby.

Obviously this is not right.

I have \> 3500 shards that won't assign.

The stack is running normally, not as quick as it used to be, but not slow however I am concerned.

What have I missed.

Any help would be greatly appreciated.

Thanks in advance

---

<div class="post-metadata">

### Author: ![shanec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shanec/32/4004_2.png) [@shanec](https://discuss.elastic.co/u/shanec)
#### Post date: [June 14, 2018, 3:19am UTC](https://discuss.elastic.co/t/way-tooooo-many-shards/135809/2 "2018-06-14T03:19:23Z")

</div>

Yikes! That is a lot of shards!

> What have I missed.

One plausible reason is you have one or more [index templates](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html) which are configured poorly. I'd look there (and any Logstash/Beats output configuration) and update them to a more sane number (certainly nothing larger than 12).

As for resolution to getting the shards to a reasonable number, you'll want to look whether these are primary shards or replica shards. If they're primary shards, there is a [shrink API](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-shrink-index.html) that you could use. You could also just delete high-shard indices if they aren't valuable anymore. You may, instead, simply have an extremely high (misconfigured) number of replicas, in which case you can just change the number of replicas for each index to a more reasonable number.

There's also a [cluster allocation explain](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-allocation-explain.html) API which can give you insights into why a shard may not be assigned.

---

<div class="post-metadata">

### Author: ![tsangdl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsangdl/32/12835_2.png) [@tsangdl](https://discuss.elastic.co/u/tsangdl)
#### Post date: [June 23, 2018, 6:45am UTC](https://discuss.elastic.co/t/way-tooooo-many-shards/135809/3 "2018-06-23T06:45:04Z")

</div>

Thanks Shanec, I'll certainly look at your recommendations

---

<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: [June 23, 2018, 7:15am UTC](https://discuss.elastic.co/t/way-tooooo-many-shards/135809/4 "2018-06-23T07:15:05Z")

</div>

If you have not already seen it, have a look at [this blog post around shards and sharding guidelines](https://www.elastic.co/blog/how-many-shards-should-i-have-in-my-elasticsearch-cluster) as well.

---

<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: [July 21, 2018, 7:15am UTC](https://discuss.elastic.co/t/way-tooooo-many-shards/135809/5 "2018-07-21T07:15:05Z")

</div>

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