# Unknown condition type \[array\_compare\]\];

**URL:** <https://discuss.elastic.co/t/unknown-condition-type-array-compare/34239>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [November 10, 2015, 1:27pm UTC](https://discuss.elastic.co/t/unknown-condition-type-array-compare/34239 "2015-11-10T13:27:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rabeetwaqar](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@rabeetwaqar](https://discuss.elastic.co/u/rabeetwaqar)\
**Post date:** [November 10, 2015, 1:27pm UTC](https://discuss.elastic.co/t/unknown-condition-type-array-compare/34239/1 "2015-11-10T13:27:40Z")

</div>

Hi,

I'm getting this error while executing watcher api.  
@steve kearns

Thanks

---

<div class="post-metadata">

**Author:** ![skearns](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skearns/32/125945_2.png) [@skearns](https://discuss.elastic.co/u/skearns)\
**Post date:** [November 10, 2015, 2:06pm UTC](https://discuss.elastic.co/t/unknown-condition-type-array-compare/34239/2 "2015-11-10T14:06:56Z")

</div>

The array\_compare condition was added in Watcher 2.0. Which version are you running?

---

<div class="post-metadata">

**Author:** ![rabeetwaqar](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@rabeetwaqar](https://discuss.elastic.co/u/rabeetwaqar)\
**Post date:** [November 10, 2015, 2:15pm UTC](https://discuss.elastic.co/t/unknown-condition-type-array-compare/34239/3 "2015-11-10T14:15:46Z")

</div>

Hello,  
Thanks for prompt reply.

I think i'm running the old version i.e i found in plugins/watcher/elasticsearch-watcher-1.0.1.jar  
I will update this and will check if this works fine for me 😄

Thanks

---

<div class="post-metadata">

**Author:** ![rabeetwaqar](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@rabeetwaqar](https://discuss.elastic.co/u/rabeetwaqar)\
**Post date:** [November 18, 2015, 1:03pm UTC](https://discuss.elastic.co/t/unknown-condition-type-array-compare/34239/4 "2015-11-18T13:03:38Z")

</div>

Hi @skearns.

I'm creating a watcher that i want to check the route performance whether it has some positive\_sessions change or negative\_sessions change.

Also i want to ask whether watcher saves history and then calculates data from history + current?

I have created this watcher please let me know where am i doing wrong

And can i create single alert for both positive and negative sessions? or do i need to create seperate?

Sorry for bad english

PUT \_watcher/watch/my\_watcher{  
"trigger": {  
"schedule": {  
"interval": "15s"  
}  
},  
"input": {  
"search": {  
"request": {  
"indices": [  
"sessions"  
],  
"body": {  
"query": {  
"filtered": {  
"query": {  
"query\_string": {  
"query": "\*",  
"analyze\_wildcard": true  
}  
},  
"filter": {  
"bool": {  
"must": [  
{  
"range": {  
"session\_time": {  
"gte": 1447242515991,  
"lte": 1447847315992,  
"format": "epoch\_millis"  
}  
}  
}  
],  
"must\_not": []  
}  
}  
}  
},  
"size": 0,  
"aggs": {  
"4": {  
"terms": {  
"field": "user\_country",  
"size": 0,  
"order": {  
"\_count": "desc"  
}  
},  
"aggs": {  
"5": {  
"terms": {  
"field": "game\_name",  
"size": 0,  
"order": {  
"\_count": "desc"  
}  
},  
"aggs": {  
"6": {  
"terms": {  
"field": "proxy\_country",  
"size": 5,  
"order": {  
"\_count": "desc"  
}  
},  
"aggs": {  
"avg\_sessions": {  
"terms": {  
"field": "game\_server\_country",  
"size": 0,  
"order": {  
"\_count": "desc"  
}  
},  
"aggs": {  
"positive\_sessions": {  
"avg": {  
"script": "doc['avg\_ping'].value \< doc['avg\_line\_ping'].value ? 1 : 0",  
"lang": "expression"  
}  
},  
"negative\_sessions": {  
"avg": {  
"script": "doc['avg\_ping'].value \> doc['avg\_line\_ping'].value ? 1 : 0",  
"lang": "expression"  
}  
}  
}  
}  
}  
}  
}  
}  
}  
}  
}  
}  
}  
}  
},  
"condition": {  
"array\_compare": {  
"{{ctx.payload.aggregations.4.buckets.0.5.buckets.0.6.buckets.0.avg\_sessions.buckets": {  
"path": "positive\_sessions",  
"gte": {  
"value": 100,  
"quantifier": "all"  
}  
}  
}  
},  
"actions": {  
"log": {  
"logging": {  
"text": "Positive sessions are increasing"  
}  
}  
}  
}

Thank you

---

<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 6, 2017, 1:48pm UTC](https://discuss.elastic.co/t/unknown-condition-type-array-compare/34239/5 "2017-07-06T13:48:09Z")

</div>


