put-lifecycle.asciidoc 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[ilm-put-lifecycle]]
  4. === Put Lifecycle Policy API
  5. ++++
  6. <titleabbrev>Put Policy</titleabbrev>
  7. ++++
  8. Creates or updates an ILM Policy
  9. ==== Request
  10. `PUT _ilm/<policy>`
  11. ==== Description
  12. This API creates a new Lifecycle Policy, or updates an existing one with the same
  13. identifier. Each call will replace the existing policy and increment the `version`
  14. associated with the policy.
  15. NOTE: The `version` is only for informational purposes. Only the latest version
  16. of the policy is stored.
  17. ==== Path Parameters
  18. `policy` (required)::
  19. (string) Identifier for the policy.
  20. ==== Request Parameters
  21. `timeout`::
  22. (time units) Specifies the period of time to wait for the completion of the
  23. PUT operation. When this period of time elapses, the API fails and returns
  24. an error. The default value is `30s`. For more information about time units,
  25. see <<time-units>>.
  26. `master_timeout`::
  27. (time units) Specifies the period of time to wait for the connection with master.
  28. When this period of time elapses, the API fails and returns an error.
  29. The default value is `30s`. For more information about time units, see <<time-units>>.
  30. ==== Examples
  31. The following example creates a new policy named `my_policy`:
  32. [source,js]
  33. --------------------------------------------------
  34. PUT _ilm/my_policy
  35. {
  36. "policy": {
  37. "phases": {
  38. "warm": {
  39. "minimum_age": "10d",
  40. "actions": {
  41. "forcemerge": {
  42. "max_num_segments": 1
  43. }
  44. }
  45. },
  46. "delete": {
  47. "minimum_age": "30d",
  48. "actions": {
  49. "delete": {}
  50. }
  51. }
  52. }
  53. }
  54. }
  55. --------------------------------------------------
  56. // CONSOLE
  57. // TEST
  58. If the request does not encounter errors, you receive the following result:
  59. [source,js]
  60. ----
  61. {
  62. "acknowledged": true
  63. }
  64. ----
  65. // CONSOLE
  66. // TESTRESPONSE