Delete Watch API

The DELETE watch API removes a watch from Watcher.

Request

DELETE _xpack/watcher/watch/<watch_id>

Description

When the watch is removed, the document representing the watch in the .watches index is gone and it will never be run again.

Please note that deleting a watch does not delete any watch execution records related to this watch from the watch history.

Deleting a watch must be done via this API only. Do not delete the watch directly from the .watches index using the Elasticsearch DELETE Document API. When X-Pack security is enabled, make sure no write privileges are granted to anyone over the .watches index.

Path Parameters

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

Query Parameters

master_timeout
(time) A timeout value for the connection to the master node.

Authorization

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

Examples

The following example deletes a watch with the my-watch id:

DELETE _xpack/watcher/watch/my_watch

Response:

{
   "found": true,
   "_id": "my_watch",
   "_version": 2
}

When deleting a watch while it is executing, the delete action will block and wait for the watch execution to finish. Depending on the nature of the watch, in some situations this can take a while. For this reason, the delete watch action is associated with a timeout that is set to 10 seconds by default. You can control this timeout by passing in the master_timeout parameter.

The following snippet shows how to change the default timeout of the delete action to 30 seconds:

DELETE _xpack/watcher/watch/my_watch?master_timeout=30s