# Elasticsearch watcher multiple indices

**URL:** <https://discuss.elastic.co/t/elasticsearch-watcher-multiple-indices/182624>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [May 24, 2019, 11:08am UTC](https://discuss.elastic.co/t/elasticsearch-watcher-multiple-indices/182624 "2019-05-24T11:08:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pszemesy](https://avatars.discourse-cdn.com/v4/letter/p/e8c25b/32.png) [@pszemesy](https://discuss.elastic.co/u/pszemesy)\
**Post date:** [May 24, 2019, 11:08am UTC](https://discuss.elastic.co/t/elasticsearch-watcher-multiple-indices/182624/1 "2019-05-24T11:08:08Z")

</div>

Hi All,

Please help me how to define a watcher in Elasticsearch for the following issue:  
It should fire an email in case of there are no new records in index\_a, but there are more than zero new records in index\_b in the last hour.

Thanks.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [May 31, 2019, 10:38am UTC](https://discuss.elastic.co/t/elasticsearch-watcher-multiple-indices/182624/2 "2019-05-31T10:38:30Z")

</div>

Hey,

you can use the `chained` input two execute two `search` inputs and then have a `script` condition that checks the hit count for both.

Hope this helps!

--Alex

---

<div class="post-metadata">

**Author:** ![pszemesy](https://avatars.discourse-cdn.com/v4/letter/p/e8c25b/32.png) [@pszemesy](https://discuss.elastic.co/u/pszemesy)\
**Post date:** [June 4, 2019, 9:58am UTC](https://discuss.elastic.co/t/elasticsearch-watcher-multiple-indices/182624/3 "2019-06-04T09:58:49Z")

</div>

Thanks.

---

<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 2, 2019, 9:58am UTC](https://discuss.elastic.co/t/elasticsearch-watcher-multiple-indices/182624/4 "2019-07-02T09:58:52Z")

</div>

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