I'm sorry for being late in response. Here are my watcher configuration and its output:
Watcher configuration:
{ "trigger": { "schedule": { "cron": "0 0/1 * * * ?" } }, "input": { "search": { "request": { "search_type": "query_then_fetch", "indices": [ "<my-name-{now/M{YYYY.MM.dd}}>" ], "types": [], "body": { "query": { "bool": { "filter": [ { "match": { "my-field": "TEXT_MATCH" } }, { "range": { "@timestamp": { "from": "{{ctx.trigger.scheduled_time}}||-60s", "to": "{{ctx.trigger.triggered_time}}" } } } ] } }, "aggs": { "ip_aggs": { "terms": { "field": "ip" } }, "xxx_aggs": { "terms": { "field": "xxx" } } }, "_source": [ "ip", "name", "xxx" ] } } } }, "condition": { "compare": { "ctx.payload.hits.total": { "gte": 1 } } }, "actions": { "my_webhook": { "webhook": { "scheme": "http", "host": "domain.com", "port": 80, "method": "post", "path": "/index.php", "params": {}, "headers": {}, "body": "{{ctx.watch_id}}+++{{#ctx.payload.aggregations.src_ip_aggs.buckets}} {{key}}({{doc_count}}) {{/ctx.payload.aggregations.src_ip_aggs.buckets}}^newline^{{#ctx.payload.aggregations.switch_ip_aggs.buckets}} {{key}}({{doc_count}}) {{/ctx.payload.aggregations.switch_ip_aggs.buckets}}" } } }, "throttle_period_in_millis": 180000 }
and watcher output:
{ "watch_id": "my-watch-name", "state": "execution_not_needed", "_status": { "state": { "active": true, "timestamp": "2017-05-29T09:35:11.142Z" }, "last_checked": "2017-05-30T02:29:00.401Z", "actions": { "my_webhook": { "ack": { "timestamp": "2017-05-29T09:35:11.142Z", "state": "awaits_successful_execution" } } } }, "trigger_event": { "type": "schedule", "triggered_time": "2017-05-30T02:29:00.401Z", "schedule": { "scheduled_time": "2017-05-30T02:29:00.000Z" } }, "input": { "search": { "request": { "search_type": "query_then_fetch", "indices": [ "<my-name-{now/M{YYYY.MM.dd}}>" ], "types": [], "body": { "query": { "bool": { "filter": [ { "match": { "my-field": "TEXT_MATCH" } }, { "range": { "@timestamp": { "from": "{{ctx.trigger.scheduled_time}}||-60s", "to": "{{ctx.trigger.triggered_time}}" } } } ] } }, "aggs": { "ip_aggs": { "terms": { "field": "ip" } }, "xxx_aggs": { "terms": { "field": "xxx" } } }, "_source": [ "ip", "name", "xxx" ] } } } }, "condition": { "compare": { "ctx.payload.hits.total": { "gte": 1 } } }, "metadata": { "name": "my-watch-name" }, "result": { "execution_time": "2017-05-30T02:29:00.401Z", "execution_duration": 1, "input": { "type": "search", "status": "success", "payload": { "_shards": { "total": 0, "failed": 0, "successful": 0 }, "hits": { "hits": [], "total": 0, "max_score": 0 }, "took": 0, "timed_out": false }, "search": { "request": { "search_type": "query_then_fetch", "indices": [ "<my-name-{now/M{YYYY.MM.dd}}>" ], "types": [], "body": { "query": { "bool": { "filter": [ { "match": { "my-field": "TEXT_MATCH" } }, { "range": { "@timestamp": { "from": "2017-05-30T02:29:00.000Z||-60s", "to": "2017-05-30T02:29:00.401Z" } } } ] } }, "aggs": { "ip_aggs": { "terms": { "field": "ip" } }, "xxx_aggs": { "terms": { "field": "xxx" } } }, "_source": [ "ip", "name", "xxx" ] } } } }, "condition": { "type": "compare", "status": "success", "met": false, "compare": { "resolved_values": { "ctx.payload.hits.total": 0 } } }, "actions": [] }, "messages": [] }