2015-04-14 17:04:48 -04:00
|
|
|
---
|
|
|
|
"Test execute watch api with empty body":
|
|
|
|
- do:
|
|
|
|
cluster.health:
|
|
|
|
wait_for_status: green
|
|
|
|
|
|
|
|
- do:
|
2015-04-28 19:08:28 -04:00
|
|
|
watcher.put_watch:
|
2015-04-14 17:04:48 -04:00
|
|
|
id: "my_logging_watch"
|
|
|
|
body: >
|
|
|
|
{
|
|
|
|
"trigger" : {
|
|
|
|
"schedule" : { "cron" : "0 0/1 * * * ?" }
|
|
|
|
},
|
|
|
|
"input" : {
|
2015-04-17 15:57:34 -04:00
|
|
|
"search" : {
|
|
|
|
"request" : {
|
|
|
|
"body" : {
|
|
|
|
"query" : {
|
|
|
|
"filtered": {
|
|
|
|
"query": {
|
|
|
|
"match": {
|
|
|
|
"response": 404
|
2015-04-14 17:04:48 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"filter": {
|
|
|
|
"range": {
|
|
|
|
"@timestamp" : {
|
|
|
|
"from": "{{ctx.trigger.scheduled_time}}||-5m",
|
|
|
|
"to": "{{ctx.trigger.triggered_time}}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"condition" : {
|
|
|
|
"script" : {
|
|
|
|
"script" : "ctx.payload.hits.total > 1"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"actions" : {
|
|
|
|
"Logging" : {
|
|
|
|
"logging" : {
|
|
|
|
"text" : "foobar"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
- match: { _id: "my_logging_watch" }
|
|
|
|
|
|
|
|
- do:
|
2015-04-28 19:08:28 -04:00
|
|
|
watcher.execute_watch:
|
2015-04-14 17:04:48 -04:00
|
|
|
id: "my_logging_watch"
|
|
|
|
body: null
|
|
|
|
|
|
|
|
- match: { "watch_id": "my_logging_watch" }
|
2015-04-27 09:33:23 -04:00
|
|
|
- match: { "watch_execution.condition_result.always": {} }
|
2015-04-14 17:04:48 -04:00
|
|
|
- match: { "state": "executed" }
|
|
|
|
- match: { "watch_execution.actions_results.Logging.logging.success" : true }
|
|
|
|
- match: { "watch_execution.actions_results.Logging.logging.logged_text" : "foobar" }
|