# Watcher

**URL:** <https://discuss.elastic.co/t/watcher/256265>\
**Category:** Kibana\
**Tags:** elastic-stack-alerting, painless\
**Created:** [November 22, 2020, 12:33pm UTC](https://discuss.elastic.co/t/watcher/256265 "2020-11-22T12:33:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Farid\_N](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/farid_n/32/74144_2.png) [@Farid\_N](https://discuss.elastic.co/u/Farid_N)\
**Post date:** [November 22, 2020, 12:33pm UTC](https://discuss.elastic.co/t/watcher/256265/1 "2020-11-22T12:33:25Z")

</div>

Hi  
How can I solve this error?

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/3/b301de66c26c1c2aa05506adcd06c7ab62b03537.png)

I think my condition is incorrect:  
"source": "if(ctx.payload.\_source.elasticsearch.cluster.stats.status == [yellow] || ctx.payload.\_source.elasticsearch.cluster.stats.nodes.count \<= 4) {return true}",

---

<div class="post-metadata">

**Author:** ![afharo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/afharo/32/75202_2.png) [@afharo](https://discuss.elastic.co/u/afharo)\
**Post date:** [November 23, 2020, 3:37pm UTC](https://discuss.elastic.co/t/watcher/256265/2 "2020-11-23T15:37:28Z")

</div>

Hi @Farid_N,

Should `yellow` be provided as a string? Can you try your script as either

```auto
"source": "if(ctx.payload._source.elasticsearch.cluster.stats.status == 'yellow' || ctx.payload._source.elasticsearch.cluster.stats.nodes.count <= 4) {return true}",

```

or

```auto
"source": "if(ctx.payload._source.elasticsearch.cluster.stats.status == ['yellow'] || ctx.payload._source.elasticsearch.cluster.stats.nodes.count <= 4) {return true}",

```

?

---

<div class="post-metadata">

**Author:** ![Farid\_N](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/farid_n/32/74144_2.png) [@Farid\_N](https://discuss.elastic.co/u/Farid_N)\
**Post date:** [November 24, 2020, 9:12am UTC](https://discuss.elastic.co/t/watcher/256265/3 "2020-11-24T09:12:16Z")

</div>

Yes, you`re right...  
I fixed this issue  
Thank you so much

---

<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:** [December 22, 2020, 9:12am UTC](https://discuss.elastic.co/t/watcher/256265/4 "2020-12-22T09:12:18Z")

</div>

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