# Total Shards Differs (dev console vs. script output)

**URL:** <https://discuss.elastic.co/t/total-shards-differs-dev-console-vs-script-output/301258>\
**Category:** Elasticsearch\
**Created:** [March 31, 2022, 9:05pm UTC](https://discuss.elastic.co/t/total-shards-differs-dev-console-vs-script-output/301258 "2022-03-31T21:05:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![codewriterguy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/codewriterguy/32/113440_2.png) [@codewriterguy](https://discuss.elastic.co/u/codewriterguy)\
**Post date:** [March 31, 2022, 9:05pm UTC](https://discuss.elastic.co/t/total-shards-differs-dev-console-vs-script-output/301258/1 "2022-03-31T21:05:03Z")

</div>

Hi lovely Elastic folks,

I have a script that rolls over a few data streams and my cluster quickly became oversharded.

The rollover requests are now failing with:  
`elasticsearch.exceptions.RequestError: RequestError(400, 'validation_exception', 'Validation Failed: 1: this action would add [2] shards, but this cluster currently has [999]/[1000] maximum normal shards open;')`

A dev console request for shards on the cluster shows only 508:  
`GET _cluster/stats?filter_path=indices.shards.total`

```auto
{
  "indices" : {
    "shards" : {
      "total" : 508
    }
  }
}

```

Anyone know why there's a discrepancy?  
Bonus questions: Does every new backing index on a data stream have to have it's own shards? And why are there 2 shards per rollover, instead of 1?

Happy to be a part of a cool community

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 31, 2022, 10:03pm UTC](https://discuss.elastic.co/t/total-shards-differs-dev-console-vs-script-output/301258/2 "2022-03-31T22:03:52Z")

</div>

I'd say the cluster stats is primary only, where as the limit is primary and replica.

---

<div class="post-metadata">

**Author:** ![codewriterguy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/codewriterguy/32/113440_2.png) [@codewriterguy](https://discuss.elastic.co/u/codewriterguy)\
**Post date:** [March 31, 2022, 10:07pm UTC](https://discuss.elastic.co/t/total-shards-differs-dev-console-vs-script-output/301258/3 "2022-03-31T22:07:44Z")

</div>

Ah nice, that makes sense as the query gets around half the max. Warkolm thanks for the help yet again!

---

<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:** [April 28, 2022, 10:08pm UTC](https://discuss.elastic.co/t/total-shards-differs-dev-console-vs-script-output/301258/4 "2022-04-28T22:08:42Z")

</div>

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