delete-lifecycle.asciidoc 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[ilm-delete-lifecycle]]
  4. === Delete lifecycle policy API
  5. ++++
  6. <titleabbrev>Delete policy</titleabbrev>
  7. ++++
  8. Deletes a lifecycle policy.
  9. ==== Request
  10. `DELETE _ilm/policy/<policy_id>`
  11. ==== Description
  12. Deletes the specified lifecycle policy definition. You cannot delete policies
  13. that are currently in use. If the policy is being used to manage any indices,
  14. the request fails and returns an error.
  15. ==== Path Parameters
  16. `policy` (required)::
  17. (string) Identifier for the policy.
  18. ==== Request Parameters
  19. include::{docdir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
  20. ==== Authorization
  21. You must have the `manage_ilm` cluster privilege to use this API.
  22. For more information, see {stack-ov}/security-privileges.html[Security Privileges].
  23. ==== Examples
  24. The following example deletes `my_policy`:
  25. //////////////////////////
  26. [source,js]
  27. --------------------------------------------------
  28. PUT _ilm/policy/my_policy
  29. {
  30. "policy": {
  31. "phases": {
  32. "warm": {
  33. "min_age": "10d",
  34. "actions": {
  35. "forcemerge": {
  36. "max_num_segments": 1
  37. }
  38. }
  39. },
  40. "delete": {
  41. "min_age": "30d",
  42. "actions": {
  43. "delete": {}
  44. }
  45. }
  46. }
  47. }
  48. }
  49. --------------------------------------------------
  50. // CONSOLE
  51. // TEST
  52. //////////////////////////
  53. [source,js]
  54. --------------------------------------------------
  55. DELETE _ilm/policy/my_policy
  56. --------------------------------------------------
  57. // CONSOLE
  58. // TEST[continued]
  59. When the policy is successfully deleted, you receive the following result:
  60. [source,console-result]
  61. --------------------------------------------------
  62. {
  63. "acknowledged": true
  64. }
  65. --------------------------------------------------