OpenSearch/docs/en/rest-api/watcher/deactivate-watch.asciidoc
Alexander Reelsen 4078b2f1b2 Watcher: Replace _status field with status (elastic/x-pack-elasticsearch#1285)
As fields with underscores will be disallowed in master, and we have to
prepare the upgrade, this commit renames the _status field to status.

When the 5.x upgrade logic is in place in the 5.x we can remove all the
old style _status handling from the master branch.

Note: All the BWC compatibility tests, that load 5.x indices are now
faking a finished upgrade by adding the `status` field to the mapping
of the watches index.

Original commit: elastic/x-pack-elasticsearch@9d5cc9aaec
2017-05-04 10:08:34 +02:00

65 lines
1.9 KiB
Plaintext

[[watcher-api-deactivate-watch]]
=== Deactivate Watch API
A watch can be either <<watch-active-state, active or inactive>>. This API
enables you to deactivate a currently active watch.
The status of an active watch is returned with the watch definition when you
call the <<watcher-api-get-watch, Get Watch API>>:
[source,js]
--------------------------------------------------
GET _xpack/watcher/watch/my_watch
--------------------------------------------------
// CONSOLE
// TEST[setup:my_active_watch]
[source,js]
--------------------------------------------------
{
"found": true,
"_id": "my_watch",
"status": {
"state" : {
"active" : true,
"timestamp" : "2015-08-20T12:21:32.734Z"
},
"actions": ...,
"version": 1
},
"watch": ...
}
--------------------------------------------------
// TESTRESPONSE[s/2015-08-20T12:21:32.734Z/$body.status.state.timestamp/]
// TESTRESPONSE[s/"actions": \.\.\./"actions": "$body.status.actions"/]
// TESTRESPONSE[s/"watch": \.\.\./"watch": "$body.watch"/]
// TESTRESPONSE[s/"version": 1/"version": $body.status.version/]
You can deactivate the watch by executing the following API call:
[source,js]
--------------------------------------------------
PUT _xpack/watcher/watch/my_watch/_deactivate
--------------------------------------------------
// CONSOLE
// TEST[setup:my_active_watch]
The new state of the watch is returned as part of its overall status:
[source,js]
--------------------------------------------------
{
"status": {
"state" : {
"active" : false,
"timestamp" : "2015-09-04T08:39:46.816Z"
},
"actions": ...,
"version": 1
}
}
--------------------------------------------------
// 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/]