I recreated my watch after successfully getting a different watch which uses compare(but no aggregation) to work. However the new watch doesn't work either and i copied the body of the working watch and just tweaked it. Here is my watch results:
{
"watch_id": "CST_Watch",
"state": "execution_not_needed",
"_status": {
"state": {
"active": true,
"timestamp": "2017-07-20T15:48:39.247Z"
},
"last_checked": "2017-07-20T16:03:39.530Z",
"actions": {
"my-logging-action": {
"ack": {
"timestamp": "2017-07-20T15:48:39.247Z",
"state": "awaits_successful_execution"
}
},
"send_email": {
"ack": {
"timestamp": "2017-07-20T15:48:39.247Z",
"state": "awaits_successful_execution"
}
}
}
},
"trigger_event": {
"type": "schedule",
"triggered_time": "2017-07-20T16:03:39.530Z",
"schedule": {
"scheduled_time": "2017-07-20T16:03:39.257Z"
}
},
"input": {
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"ts*"
],
"types": [],
"body": {
"size": 0,
"query": {
"bool": {
"must": [
{
"range": {
"dt": {
"gte": "now-24h"
}
}
}
]
}
},
"aggs": {
"avg_cst": {
"avg": {
"field": "CallSetupTime"
}
}
}
}
}
}
},
"condition": {
"compare": {
"ctx.payload.aggregations.avg_cst": {
"gte": 500
}
}
},
"metadata": {
"name": "Call Setup Time Watch"
},
"result": {
"execution_time": "2017-07-20T16:03:39.530Z",
"execution_duration": 20,
"input": {
"type": "search",
"status": "success",
"payload": {
"_shards": {
"total": 75,
"failed": 0,
"successful": 75
},
"hits": {
"hits": [],
"total": 505829,
"max_score": 0
},
"took": 19,
"timed_out": false,
"aggregations": {
"avg_cst": {
"value": 1204.9892663064395
}
}
},
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"ts*"
],
"types": [],
"body": {
"size": 0,
"query": {
"bool": {
"must": [
{
"range": {
"dt": {
"gte": "now-24h"
}
}
}
]
}
},
"aggs": {
"avg_cst": {
"avg": {
"field": "CallSetupTime"
}
}
}
}
}
}
},
"condition": {
"type": "compare",
"status": "success",
"met": false,
"compare": {
"resolved_values": {
"ctx.payload.aggregations.avg_cst": {
"value": 1204.9892663064395
}
}
}
},
"actions": []
},
"messages": []
}