--- "Test execute watch api": - do: cluster.health: wait_for_status: green - do: watcher.put_watch: id: "my_exe_watch" body: > { "trigger" : { "schedule" : { "cron" : "0 0 0 1 * ? 2099" } }, "input" : { "search" : { "request" : { "indices" : [ "logstash*" ], "body" : { "query" : { "bool": { "must" : { "match": { "response": 404 } }, "filter": { "range": { "@timestamp" : { "from": "{{ctx.trigger.scheduled_time}}||-5m", "to": "{{ctx.trigger.triggered_time}}" } } } } } } } } }, "condition" : { "script" : { "inline" : "ctx.payload.hits.total > 1" } }, "actions" : { "email_admin" : { "email" : { "to" : "someone@domain.host.com", "subject" : "404 recently encountered" } } } } - match: { _id: "my_exe_watch" } - do: watcher.execute_watch: id: "my_exe_watch" body: > { "trigger_data" : { "scheduled_time" : "2015-05-05T20:58:02.443Z", "triggered_time" : "2015-05-05T20:58:02.443Z" }, "alternative_input" : { "foo" : "bar" }, "ignore_condition" : true, "action_modes" : { "_all" : "force_simulate" }, "record_execution" : true } - match: { "watch_record.watch_id": "my_exe_watch" } - match: { "watch_record.state": "executed" } - match: { "watch_record.trigger_event.type": "manual" } - match: { "watch_record.trigger_event.triggered_time": "2015-05-05T20:58:02.443Z" } - match: { "watch_record.trigger_event.manual.schedule.scheduled_time": "2015-05-05T20:58:02.443Z" } - match: { "watch_record.result.input.type": "simple" } - match: { "watch_record.result.input.status": "success" } - match: { "watch_record.result.input.payload.foo": "bar" } - match: { "watch_record.result.condition.type": "always" } - match: { "watch_record.result.condition.status": "success" } - match: { "watch_record.result.condition.met": true } - match: { "watch_record.result.actions.0.id" : "email_admin" } - match: { "watch_record.result.actions.0.status" : "simulated" } - match: { "watch_record.result.actions.0.type" : "email" } - match: { "watch_record.result.actions.0.email.message.subject" : "404 recently encountered" }