2017-06-27 20:16:51 -04:00
|
|
|
[role="xpack"]
|
2017-03-29 12:07:55 -04:00
|
|
|
[[watcher-api-activate-watch]]
|
2018-12-20 13:23:28 -05:00
|
|
|
=== Activate watch API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Activate watch</titleabbrev>
|
|
|
|
++++
|
2017-03-29 12:07:55 -04:00
|
|
|
|
2019-09-30 13:18:50 -04:00
|
|
|
A watch can be either <<watch-active-state,active or inactive>>. This
|
2017-06-27 20:16:51 -04:00
|
|
|
API enables you to activate a currently inactive watch.
|
2017-03-29 12:07:55 -04:00
|
|
|
|
2019-09-05 14:19:35 -04:00
|
|
|
[[watcher-api-activate-watch-request]]
|
|
|
|
==== {api-request-title}
|
2017-09-14 16:01:47 -04:00
|
|
|
|
2018-12-08 13:57:16 -05:00
|
|
|
`PUT _watcher/watch/<watch_id>/_activate`
|
2017-09-14 16:01:47 -04:00
|
|
|
|
2019-09-05 14:19:35 -04:00
|
|
|
[[watcher-api-activate-watch-prereqs]]
|
|
|
|
==== {api-prereq-title}
|
2017-09-14 16:01:47 -04:00
|
|
|
|
2019-09-05 14:19:35 -04:00
|
|
|
* You must have `manage_watcher` cluster privileges to use this API. For more
|
2019-10-07 18:23:19 -04:00
|
|
|
information, see <<security-privileges>>.
|
2017-09-14 16:01:47 -04:00
|
|
|
|
2019-09-05 14:19:35 -04:00
|
|
|
//[[watcher-api-activate-watch-desc]]
|
|
|
|
//==== {api-description-title}
|
2017-09-14 16:01:47 -04:00
|
|
|
|
2019-09-05 14:19:35 -04:00
|
|
|
[[watcher-api-activate-watch-path-params]]
|
|
|
|
==== {api-path-parms-title}
|
2017-09-14 16:01:47 -04:00
|
|
|
|
2019-09-05 14:19:35 -04:00
|
|
|
`<watch_id>`::
|
|
|
|
(Required, string) Identifier for the watch.
|
|
|
|
|
|
|
|
//[[watcher-api-activate-watch-query-params]]
|
|
|
|
//==== {api-query-parms-title}
|
|
|
|
|
|
|
|
//[[watcher-api-activate-watch-request-body]]
|
|
|
|
//==== {api-request-body-title}
|
|
|
|
|
|
|
|
//[[watcher-api-activate-watch-response-body]]
|
|
|
|
//==== {api-response-body-title}
|
|
|
|
|
|
|
|
//[[watcher-api-activate-watch-response-codes]]
|
|
|
|
//==== {api-response-codes-title}
|
|
|
|
|
|
|
|
[[watcher-api-activate-watch-example]]
|
|
|
|
==== {api-examples-title}
|
2017-09-14 16:01:47 -04:00
|
|
|
|
2017-03-29 12:07:55 -04:00
|
|
|
The status of an inactive watch is returned with the watch definition when you
|
2019-09-05 14:19:35 -04:00
|
|
|
call the <<watcher-api-get-watch,get watch API>>:
|
2017-03-29 12:07:55 -04:00
|
|
|
|
2019-09-09 12:35:50 -04:00
|
|
|
[source,console]
|
2017-03-29 12:07:55 -04:00
|
|
|
--------------------------------------------------
|
2018-12-08 13:57:16 -05:00
|
|
|
GET _watcher/watch/my_watch
|
2017-03-29 12:07:55 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[setup:my_inactive_watch]
|
|
|
|
|
2019-09-06 16:09:09 -04:00
|
|
|
[source,console-result]
|
2017-03-29 12:07:55 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"found": true,
|
|
|
|
"_id": "my_watch",
|
2019-01-30 20:14:59 -05:00
|
|
|
"_seq_no": 0,
|
|
|
|
"_primary_term": 1,
|
2018-02-20 04:09:27 -05:00
|
|
|
"_version": 1,
|
2017-05-04 04:08:34 -04:00
|
|
|
"status": {
|
2017-03-29 12:07:55 -04:00
|
|
|
"state" : {
|
|
|
|
"active" : false,
|
|
|
|
"timestamp" : "2015-08-20T12:21:32.734Z"
|
|
|
|
},
|
|
|
|
"actions": ...,
|
|
|
|
"version": 1
|
|
|
|
},
|
|
|
|
"watch": ...
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
2017-05-04 04:08:34 -04:00
|
|
|
// TESTRESPONSE[s/2015-08-20T12:21:32.734Z/$body.status.state.timestamp/]
|
|
|
|
// TESTRESPONSE[s/"actions": \.\.\./"actions": "$body.status.actions"/]
|
2017-03-29 12:07:55 -04:00
|
|
|
// TESTRESPONSE[s/"watch": \.\.\./"watch": "$body.watch"/]
|
2017-05-04 04:08:34 -04:00
|
|
|
// TESTRESPONSE[s/"version": 1/"version": $body.status.version/]
|
2017-03-29 12:07:55 -04:00
|
|
|
|
|
|
|
You can activate the watch by executing the following API call:
|
|
|
|
|
2019-09-09 12:35:50 -04:00
|
|
|
[source,console]
|
2017-03-29 12:07:55 -04:00
|
|
|
--------------------------------------------------
|
2018-12-08 13:57:16 -05:00
|
|
|
PUT _watcher/watch/my_watch/_activate
|
2017-03-29 12:07:55 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[setup:my_inactive_watch]
|
|
|
|
|
|
|
|
The new state of the watch is returned as part of its overall status:
|
|
|
|
|
2019-09-06 16:09:09 -04:00
|
|
|
[source,console-result]
|
2017-03-29 12:07:55 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
2017-05-04 04:08:34 -04:00
|
|
|
"status": {
|
2017-03-29 12:07:55 -04:00
|
|
|
"state" : {
|
|
|
|
"active" : true,
|
|
|
|
"timestamp" : "2015-09-04T08:39:46.816Z"
|
|
|
|
},
|
|
|
|
"actions": ...,
|
|
|
|
"version": 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
2017-05-04 04:08:34 -04:00
|
|
|
// TESTRESPONSE[s/2015-09-04T08:39:46.816Z/$body.status.state.timestamp/]
|
|
|
|
// TESTRESPONSE[s/"actions": \.\.\./"actions": "$body.status.actions"/]
|
|
|
|
// TESTRESPONSE[s/"version": 1/"version": $body.status.version/]
|