# Can I get an email alert on watcher when no data found?

**URL:** <https://discuss.elastic.co/t/can-i-get-an-email-alert-on-watcher-when-no-data-found/114437>\
**Category:** Elasticsearch\
**Created:** [January 8, 2018, 12:47am UTC](https://discuss.elastic.co/t/can-i-get-an-email-alert-on-watcher-when-no-data-found/114437 "2018-01-08T00:47:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![saradac](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@saradac](https://discuss.elastic.co/u/saradac)\
**Post date:** [January 8, 2018, 12:47am UTC](https://discuss.elastic.co/t/can-i-get-an-email-alert-on-watcher-when-no-data-found/114437/1 "2018-01-08T00:47:13Z")

</div>

Hi All,

I want to execute a file. When no logs on specific time, I want email alert.  
Is this possible through watcher?

When there is no data found, I can't get any email alerts.

---

<div class="post-metadata">

**Author:** ![jpcarey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpcarey/32/46668_2.png) [@jpcarey](https://discuss.elastic.co/u/jpcarey)\
**Post date:** [January 8, 2018, 2:13am UTC](https://discuss.elastic.co/t/can-i-get-an-email-alert-on-watcher-when-no-data-found/114437/2 "2018-01-08T02:13:25Z")

</div>

Yes.  
[https://www.elastic.co/guide/en/x-pack/current/condition-compare.html#\_using\_a\_compare\_condition](https://www.elastic.co/guide/en/x-pack/current/condition-compare.html#_using_a_compare_condition)

The condition below would execute any of the watch actions when the search result return less than or equal to 0.

```auto
{
  "condition" : {
    "compare" : {
      "ctx.payload.hits.total" : { 
        "lte" : 0
      }
  }
}

```

---

<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:** [February 5, 2018, 2:13am UTC](https://discuss.elastic.co/t/can-i-get-an-email-alert-on-watcher-when-no-data-found/114437/3 "2018-02-05T02:13:40Z")

</div>

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