Deactivate watch API

edit

A watch can be either active or inactive. This API enables you to deactivate a currently active watch.

Request

edit

PUT _xpack/watcher/watch/<watch_id>/_deactivate

Path Parameters

edit
watch_id (required)
(string) Identifier for the watch.

Authorization

edit

You must have manage_watcher cluster privileges to use this API. For more information, see Security privileges.

Examples

edit

The status of an active watch is returned with the watch definition when you call the Get Watch API:

GET _xpack/watcher/watch/my_watch
{
  "found": true,
  "_id": "my_watch",
  "_version": 1,
  "_seq_no": 0,
  "_primary_term": 1,
  "status": {
    "state" : {
      "active" : true,
      "timestamp" : "2015-08-20T12:21:32.734Z"
    },
    "actions": ...,
    "version": 1
  },
  "watch": ...
}

You can deactivate the watch by executing the following API call:

PUT _xpack/watcher/watch/my_watch/_deactivate

The new state of the watch is returned as part of its overall status:

{
  "status": {
    "state" : {
      "active" : false,
      "timestamp" : "2015-09-04T08:39:46.816Z"
    },
    "actions": ...,
    "version": 1
  }
}