110 lines
2.2 KiB
Plaintext
110 lines
2.2 KiB
Plaintext
[role="xpack"]
|
|
[[watcher-api-get-watch]]
|
|
=== Get watch API
|
|
++++
|
|
<titleabbrev>Get watch</titleabbrev>
|
|
++++
|
|
|
|
Retrieves a watch by its ID.
|
|
|
|
[[watcher-api-get-watch-request]]
|
|
==== {api-request-title}
|
|
|
|
`GET _watcher/watch/<watch_id>`
|
|
|
|
[[watcher-api-get-watch-prereqs]]
|
|
==== {api-prereq-title}
|
|
|
|
* You must have `manage_watcher` or `monitor_watcher` cluster privileges to use
|
|
this API. For more information, see
|
|
<<security-privileges>>.
|
|
|
|
//[[watcher-api-get-watch-desc]]
|
|
//==== {api-description-title}
|
|
|
|
[[watcher-api-get-watch-path-params]]
|
|
==== {api-path-parms-title}
|
|
|
|
`<watch_id>`::
|
|
(Required, string) Identifier for the watch.
|
|
|
|
//[[watcher-api-get-watch-query-params]]
|
|
//==== {api-query-parms-title}
|
|
|
|
//[[watcher-api-get-watch-request-body]]
|
|
//==== {api-request-body-title}
|
|
|
|
//[[watcher-api-get-watch-response-body]]
|
|
//==== {api-response-body-title}
|
|
|
|
//[[watcher-api-get-watch-response-codes]]
|
|
//==== {api-response-codes-title}
|
|
|
|
[[watcher-api-get-watch-example]]
|
|
==== {api-examples-title}
|
|
|
|
The following example gets a watch with `my-watch` id:
|
|
|
|
[source,console]
|
|
--------------------------------------------------
|
|
GET _watcher/watch/my_watch
|
|
--------------------------------------------------
|
|
// TEST[setup:my_active_watch]
|
|
|
|
Response:
|
|
|
|
[source,console-result]
|
|
--------------------------------------------------
|
|
{
|
|
"found": true,
|
|
"_id": "my_watch",
|
|
"_seq_no": 0,
|
|
"_primary_term": 1,
|
|
"_version": 1,
|
|
"status": { <1>
|
|
"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"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
--------------------------------------------------
|
|
// TESTRESPONSE[s/"timestamp": "2015-05-26T18:21:08.630Z"/"timestamp": "$body.status.state.timestamp"/]
|
|
|
|
<1> The current status of the watch
|