# Alert - no documents in elasticsearch for a given time

**URL:** https://discuss.elastic.co/t/alert-no-documents-in-elasticsearch-for-a-given-time/253453
**Category:** Elastic Observability
**Tags:** elastic-stack-alerting
**Created:** [October 27, 2020, 3:10pm UTC](https://discuss.elastic.co/t/alert-no-documents-in-elasticsearch-for-a-given-time/253453 "2020-10-27T15:10:27Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![grynhtjnyuk](https://avatars.discourse-cdn.com/v4/letter/g/ee59a6/32.png) [@grynhtjnyuk](https://discuss.elastic.co/u/grynhtjnyuk)
#### Post date: [October 27, 2020, 3:10pm UTC](https://discuss.elastic.co/t/alert-no-documents-in-elasticsearch-for-a-given-time/253453/1 "2020-10-27T15:10:27Z")

</div>

I have a simmilar query in Grafana like below. I can write queries from elasticsearch there. Could you tell me what query should I use to create an alert based on the query. The alert to fire when no any document in provided to elastic for a given time (5 min for example)

![Screenshot_2020-10-27 Alerting when count is 0 or no data](https://us1.discourse-cdn.com/elastic/original/3X/9/4/94230e5ae1da9b358c29cac921afb0c470c5114e.png)

---

<div class="post-metadata">

### Author: ![weltenwort](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weltenwort/32/53885_2.png) [@weltenwort](https://discuss.elastic.co/u/weltenwort)
#### Post date: [October 27, 2020, 5:43pm UTC](https://discuss.elastic.co/t/alert-no-documents-in-elasticsearch-for-a-given-time/253453/2 "2020-10-27T17:43:52Z")

</div>

Hi @grynhtjnyuk,

I'm not sure I understand which tool you want to use to perform the alerting. If you're looking for creating such an alert within Grafana, the [documentation](https://grafana.com/docs/grafana/latest/alerting/create-alerts/) suggests it should be easy to create a rule based on `count()`.

---

<div class="post-metadata">

### Author: ![grynhtjnyuk](https://avatars.discourse-cdn.com/v4/letter/g/ee59a6/32.png) [@grynhtjnyuk](https://discuss.elastic.co/u/grynhtjnyuk)
#### Post date: [October 28, 2020, 9:08am UTC](https://discuss.elastic.co/t/alert-no-documents-in-elasticsearch-for-a-given-time/253453/3 "2020-10-28T09:08:47Z")

</div>

hi , I meant elastic query, to check that zero documents provided for 5 minutes

---

<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: [November 4, 2022, 8:16am UTC](https://discuss.elastic.co/t/alert-no-documents-in-elasticsearch-for-a-given-time/253453/4 "2022-11-04T08:16:22Z")

</div>


