2020-07-23 23:48:22 +08:00
|
|
|
[discrete]
|
2017-03-29 05:23:01 +08:00
|
|
|
[[api-java-delete-watch]]
|
2019-09-28 07:05:44 +08:00
|
|
|
=== Delete watch API
|
2017-03-29 05:23:01 +08:00
|
|
|
|
2019-09-28 07:05:44 +08:00
|
|
|
The delete watch API removes a watch (identified by its `id`) from {watcher}.
|
2017-03-29 05:23:01 +08:00
|
|
|
Once removed, the document representing the watch in the `.watches` index is
|
|
|
|
gone and it will never be executed again.
|
|
|
|
|
|
|
|
Please note that deleting a watch **does not** delete any watch execution records
|
|
|
|
related to this watch from the watch history.
|
|
|
|
|
|
|
|
IMPORTANT: Deleting a watch must be done via this API only. Do not delete the
|
|
|
|
watch directly from the `.watches` index using Elasticsearch's DELETE
|
2018-12-20 06:53:37 +08:00
|
|
|
Document API. If the {es} {security-features} are enabled, make sure
|
|
|
|
no `write` privileges are granted to anyone over the `.watches` index.
|
2017-03-29 05:23:01 +08:00
|
|
|
|
|
|
|
The following example deletes a watch with the `my-watch` id:
|
|
|
|
|
|
|
|
[source,java]
|
|
|
|
--------------------------------------------------
|
|
|
|
DeleteWatchResponse deleteWatchResponse = watcherClient.prepareDeleteWatch("my-watch").get();
|
|
|
|
--------------------------------------------------
|