# Alert when detecting a specific number of shards on index

**URL:** <https://discuss.elastic.co/t/alert-when-detecting-a-specific-number-of-shards-on-index/193472>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [August 2, 2019, 7:49am UTC](https://discuss.elastic.co/t/alert-when-detecting-a-specific-number-of-shards-on-index/193472 "2019-08-02T07:49:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nepes](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@nepes](https://discuss.elastic.co/u/nepes)\
**Post date:** [August 2, 2019, 7:49am UTC](https://discuss.elastic.co/t/alert-when-detecting-a-specific-number-of-shards-on-index/193472/1 "2019-08-02T07:49:34Z")

</div>

I would like to detect when a number of shards per index passes some threshold.

I use Metricbeat with Elasticsearch module to retrieve metrics data from indices and ElastAlert to send alerts when some number of shards per index is detected.

At first, I thought I could somehow use the `_stats` API or `_settings` endpoint in order to access the number of shards per index and run ElastAlert on this number. However, as far as I know, ElastAlert scans only the `_doc` section of indices, and not `_stats` or `_settings` .

As written in the [docs](https://www.elastic.co/guide/en/beats/metricbeat/6.7/exported-fields-elasticsearch.html) of Elasticsearch module of Metricbeat, there is a `elasticsearch.cluster.stats.indices.shards.count` field which lists the number of shards for the whole _cluster_ :

> **`elasticsearch.cluster.stats.indices.shards.count`**  
>   type: long
> 
>   Total number of shards in cluster.

I wonder if there is something similar to that but for each _index_ ? If not, what are the possible workarounds?

---

<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:** [August 30, 2019, 7:50am UTC](https://discuss.elastic.co/t/alert-when-detecting-a-specific-number-of-shards-on-index/193472/2 "2019-08-30T07:50:03Z")

</div>

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