delete-watch.asciidoc 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. [role="xpack"]
  2. [[watcher-api-delete-watch]]
  3. === Delete Watch API
  4. The DELETE watch API removes a watch from {watcher}.
  5. [float]
  6. ==== Request
  7. `DELETE _xpack/watcher/watch/<watch_id>`
  8. [float]
  9. ==== Description
  10. When the watch is removed, the document representing the watch in the `.watches`
  11. index is gone and it will never be run again.
  12. Please note that deleting a watch **does not** delete any watch execution records
  13. related to this watch from the watch history.
  14. IMPORTANT: Deleting a watch must be done via this API only. Do not delete the
  15. watch directly from the `.watches` index using the Elasticsearch
  16. DELETE Document API. When {security} is enabled, make sure no `write`
  17. privileges are granted to anyone over the `.watches` index.
  18. [float]
  19. ==== Path Parameters
  20. `watch_id` (required)::
  21. (string) Identifier for the watch.
  22. [float]
  23. ==== Authorization
  24. You must have `manage_watcher` cluster privileges to use this API. For more
  25. information, see {xpack-ref}/security-privileges.html[Security Privileges].
  26. [float]
  27. ==== Examples
  28. The following example deletes a watch with the `my-watch` id:
  29. [source,js]
  30. --------------------------------------------------
  31. DELETE _xpack/watcher/watch/my_watch
  32. --------------------------------------------------
  33. // CONSOLE
  34. // TEST[setup:my_active_watch]
  35. Response:
  36. [source,js]
  37. --------------------------------------------------
  38. {
  39. "found": true,
  40. "_id": "my_watch",
  41. "_version": 2
  42. }
  43. --------------------------------------------------
  44. // TESTRESPONSE