# Watcher multiple if statements or and if

**URL:** <https://discuss.elastic.co/t/watcher-multiple-if-statements-or-and-if/174533>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [March 29, 2019, 12:25pm UTC](https://discuss.elastic.co/t/watcher-multiple-if-statements-or-and-if/174533 "2019-03-29T12:25:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![forestnd](https://avatars.discourse-cdn.com/v4/letter/f/e47774/32.png) [@forestnd](https://discuss.elastic.co/u/forestnd)\
**Post date:** [March 29, 2019, 12:25pm UTC](https://discuss.elastic.co/t/watcher-multiple-if-statements-or-and-if/174533/1 "2019-03-29T12:25:34Z")

</div>

Hay all

Is it possible in an watcher condition script to set and and if for exanple

alert only if threshold below`max_threshold` but above `min_threshold`

Trying to set the alert to auto close, but not want this action to trigger every time

---

<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:** [April 1, 2019, 8:10am UTC](https://discuss.elastic.co/t/watcher-multiple-if-statements-or-and-if/174533/2 "2019-04-01T08:10:27Z")

</div>

Hey,

if you are using the `script` based condition, checking for several contents of the payload is not a problem at all. Something like this:

```auto
return ctx.payload.some_value > 1 and ctx.payload.other_value < 10

```

hope this helps!

--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:** [April 29, 2019, 8:17am UTC](https://discuss.elastic.co/t/watcher-multiple-if-statements-or-and-if/174533/3 "2019-04-29T08:17:59Z")

</div>

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