delete-lifecycle.asciidoc 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. [[ilm-delete-lifecycle-request]]
  10. ==== {api-request-title}
  11. `DELETE _ilm/policy/<policy_id>`
  12. [[ilm-delete-lifecycle-prereqs]]
  13. ==== {api-prereq-title}
  14. * If the {es} {security-features} are enabled, you must have the `manage_ilm`
  15. cluster privilege to use this API. For more information, see
  16. <<security-privileges>>.
  17. [[ilm-delete-lifecycle-desc]]
  18. ==== {api-description-title}
  19. Deletes the specified lifecycle policy definition. You cannot delete policies
  20. that are currently in use. If the policy is being used to manage any indices,
  21. the request fails and returns an error.
  22. [[ilm-delete-lifecycle-path-params]]
  23. ==== {api-path-parms-title}
  24. `<policy_id>`::
  25. (Required, string) Identifier for the policy.
  26. [[ilm-delete-lifecycle-query-params]]
  27. ==== {api-query-parms-title}
  28. include::{docdir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
  29. [[ilm-delete-lifecycle-example]]
  30. ==== {api-examples-title}
  31. The following example deletes `my_policy`:
  32. //////////////////////////
  33. [source,console]
  34. --------------------------------------------------
  35. PUT _ilm/policy/my_policy
  36. {
  37. "policy": {
  38. "phases": {
  39. "warm": {
  40. "min_age": "10d",
  41. "actions": {
  42. "forcemerge": {
  43. "max_num_segments": 1
  44. }
  45. }
  46. },
  47. "delete": {
  48. "min_age": "30d",
  49. "actions": {
  50. "delete": {}
  51. }
  52. }
  53. }
  54. }
  55. }
  56. --------------------------------------------------
  57. // TEST
  58. //////////////////////////
  59. [source,console]
  60. --------------------------------------------------
  61. DELETE _ilm/policy/my_policy
  62. --------------------------------------------------
  63. // TEST[continued]
  64. When the policy is successfully deleted, you receive the following result:
  65. [source,console-result]
  66. --------------------------------------------------
  67. {
  68. "acknowledged": true
  69. }
  70. --------------------------------------------------