Deactivate watch API

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

Request

PUT _watcher/watch/<watch_id>/_deactivate

Prerequisites

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

Path parameters

<watch_id>

(Required, string) Identifier for the watch.

Examples

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

  1. GET _watcher/watch/my_watch
  1. {
  2. "found": true,
  3. "_id": "my_watch",
  4. "_version": 1,
  5. "_seq_no": 0,
  6. "_primary_term": 1,
  7. "status": {
  8. "state" : {
  9. "active" : true,
  10. "timestamp" : "2015-08-20T12:21:32.734Z"
  11. },
  12. "actions": ...,
  13. "version": 1
  14. },
  15. "watch": ...
  16. }

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

  1. PUT _watcher/watch/my_watch/_deactivate

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

  1. {
  2. "status": {
  3. "state" : {
  4. "active" : false,
  5. "timestamp" : "2015-09-04T08:39:46.816Z"
  6. },
  7. "actions": ...,
  8. "version": 1
  9. }
  10. }