delete-watch.asciidoc 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 _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 {es} {security-features} are enabled, make
  17. sure no `write` privileges are granted to anyone over the `.watches`
  18. index.
  19. [float]
  20. ==== Path Parameters
  21. `watch_id` (required)::
  22. (string) Identifier for the watch.
  23. [float]
  24. ==== Authorization
  25. You must have `manage_watcher` cluster privileges to use this API. For more
  26. information, see {xpack-ref}/security-privileges.html[Security Privileges].
  27. [float]
  28. ==== Examples
  29. The following example deletes a watch with the `my-watch` id:
  30. [source,js]
  31. --------------------------------------------------
  32. DELETE _watcher/watch/my_watch
  33. --------------------------------------------------
  34. // CONSOLE
  35. // TEST[setup:my_active_watch]
  36. Response:
  37. [source,js]
  38. --------------------------------------------------
  39. {
  40. "found": true,
  41. "_id": "my_watch",
  42. "_version": 2
  43. }
  44. --------------------------------------------------
  45. // TESTRESPONSE