2017-06-27 20:16:51 -04:00
|
|
|
[role="xpack"]
|
2017-03-29 12:07:55 -04:00
|
|
|
[[watcher-api-get-watch]]
|
2018-12-20 13:23:28 -05:00
|
|
|
=== Get watch API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Get watch</titleabbrev>
|
|
|
|
++++
|
2017-03-29 12:07:55 -04:00
|
|
|
|
2017-09-14 16:01:47 -04:00
|
|
|
This API retrieves a watch by its ID.
|
|
|
|
|
|
|
|
[float]
|
|
|
|
==== Request
|
|
|
|
|
2018-12-08 13:57:16 -05:00
|
|
|
`GET _watcher/watch/<watch_id>`
|
2017-09-14 16:01:47 -04:00
|
|
|
|
|
|
|
[float]
|
|
|
|
==== Path Parameters
|
|
|
|
|
|
|
|
`watch_id` (required)::
|
|
|
|
(string) Identifier for the watch.
|
|
|
|
|
|
|
|
[float]
|
|
|
|
==== Authorization
|
|
|
|
|
|
|
|
You must have `manage_watcher` or `monitor_watcher` cluster privileges to use
|
|
|
|
this API. For more information, see
|
|
|
|
{xpack-ref}/security-privileges.html[Security Privileges].
|
|
|
|
|
|
|
|
[float]
|
|
|
|
==== Examples
|
2017-03-29 12:07:55 -04:00
|
|
|
|
|
|
|
The following example gets a watch with `my-watch` id:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
2018-12-08 13:57:16 -05:00
|
|
|
GET _watcher/watch/my_watch
|
2017-03-29 12:07:55 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// TEST[setup:my_active_watch]
|
|
|
|
|
|
|
|
Response:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"found": true,
|
|
|
|
"_id": "my_watch",
|
2018-02-20 04:09:27 -05:00
|
|
|
"_version": 1,
|
2017-05-04 04:08:34 -04:00
|
|
|
"status": { <1>
|
2017-03-29 12:07:55 -04:00
|
|
|
"version": 1,
|
|
|
|
"state": {
|
|
|
|
"active": true,
|
|
|
|
"timestamp": "2015-05-26T18:21:08.630Z"
|
|
|
|
},
|
|
|
|
"actions": {
|
|
|
|
"test_index": {
|
|
|
|
"ack": {
|
|
|
|
"timestamp": "2015-05-26T18:21:08.630Z",
|
|
|
|
"state": "awaits_successful_execution"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"watch": {
|
|
|
|
"input": {
|
|
|
|
"simple": {
|
|
|
|
"payload": {
|
|
|
|
"send": "yes"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"condition": {
|
|
|
|
"always": {}
|
|
|
|
},
|
|
|
|
"trigger": {
|
|
|
|
"schedule": {
|
|
|
|
"hourly": {
|
|
|
|
"minute": [0, 5]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"actions": {
|
|
|
|
"test_index": {
|
|
|
|
"index": {
|
|
|
|
"index": "test",
|
|
|
|
"doc_type": "test2"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
2017-05-04 04:08:34 -04:00
|
|
|
// TESTRESPONSE[s/"timestamp": "2015-05-26T18:21:08.630Z"/"timestamp": "$body.status.state.timestamp"/]
|
2017-03-29 12:07:55 -04:00
|
|
|
<1> The current status of the watch
|