Unknown condition type [array_compare]];

Hi,

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

Thanks

The array_compare condition was added in Watcher 2.0. Which version are you running?

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 :smile:

Thanks

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