OpenSearch/watcher/docs/reference/java/delete-watch.asciidoc

20 lines
997 B
Plaintext

[[api-java-delete-watch]]
==== Delete Watch API
The DELETE watch API removes a specific watch (identified by its `id`) from Watcher. Once removed, the document
representing the watchin the `.watches` index will be gone and it will never be executed again.
Please not that deleting a watch **does not** delete any watch execution records related to this watch from
the <<watch-history, 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 Document API. When integrating with Shield, a best practice is to make sure
no `write` privileges are granted to anyone over the `.watches` API.
The following example deletes a watch with the `my-watch` id:
[source,java]
--------------------------------------------------
DeleteWatchResponse deleteWatchResponse = watcherClient.prepareDeleteWatch("my-watch").get();
--------------------------------------------------