# \[Watcher\]If else like conditionals?

**URL:** <https://discuss.elastic.co/t/watcher-if-else-like-conditionals/141719>\
**Category:** Elasticsearch\
**Created:** [July 26, 2018, 8:35am UTC](https://discuss.elastic.co/t/watcher-if-else-like-conditionals/141719 "2018-07-26T08:35:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sjaak01](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@Sjaak01](https://discuss.elastic.co/u/Sjaak01)\
**Post date:** [July 26, 2018, 8:35am UTC](https://discuss.elastic.co/t/watcher-if-else-like-conditionals/141719/1 "2018-07-26T08:35:37Z")

</div>

Hi,

Is it possible to use some form of conditionals to run different conditionals and actions based on a query?

e.g. I want to write a query that returns a SUM for field A and returns true/false for field B and C and then execute the watcher like this:

If query result SUM field A is \> 100 and field B is false  
Run report action  
Write field B true to myindex  
else if SUM field A is \> 200 and field B is true  
Run report action  
else if SUM field A is \> 300 and field C is false or Field C does not exist  
Do nothing & end

The goal is to have a single watcher generate reports if certain values are exceeded but only at certain values based on the interval.

I don't think this can be done with throttling so I'm looking for a different solution.

---

<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:** [July 26, 2018, 9:30am UTC](https://discuss.elastic.co/t/watcher-if-else-like-conditionals/141719/2 "2018-07-26T09:30:19Z")

</div>

hey,

every action can have its own condition. See [https://www.elastic.co/guide/en/elastic-stack-overview/6.3/action-conditions.html](https://www.elastic.co/guide/en/elastic-stack-overview/6.3/action-conditions.html)

--Alex

---

<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 23, 2018, 9:30am UTC](https://discuss.elastic.co/t/watcher-if-else-like-conditionals/141719/3 "2018-08-23T09:30:20Z")

</div>

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