move-to-step.asciidoc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[ilm-move-to-step]]
  4. === Move to lifecycle step API
  5. ++++
  6. <titleabbrev>Move to step</titleabbrev>
  7. ++++
  8. Triggers execution of a specific step in the lifecycle policy.
  9. [[ilm-move-to-step-request]]
  10. ==== {api-request-title}
  11. `POST _ilm/move/<index>`
  12. [[ilm-move-to-step-prereqs]]
  13. ==== {api-prereq-title}
  14. * If the {es} {security-features} are enabled, you must have the `manage_ilm`
  15. privileges on the indices being managed to use this API. For more information,
  16. see <<security-privileges>>.
  17. [[ilm-move-to-step-desc]]
  18. ==== {api-description-title}
  19. WARNING: This operation can result in the loss of data. Manually moving an index
  20. into a specific step executes that step even if it has already been performed.
  21. This is a potentially destructive action and this should be considered an expert
  22. level API.
  23. Manually moves an index into the specified step and executes that step.
  24. You must specify both the current step and the step to be executed in the
  25. body of the request.
  26. The request will fail if the current step does not match the step currently
  27. being executed for the index. This is to prevent the index from being moved from
  28. an unexpected step into the next step.
  29. [[ilm-move-to-step-path-params]]
  30. ==== {api-path-parms-title}
  31. `<index>`::
  32. (Required, string) Identifier for the index.
  33. [[ilm-move-to-step-query-params]]
  34. ==== {api-query-parms-title}
  35. include::{docdir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
  36. [[ilm-move-to-step-example]]
  37. ==== {api-examples-title}
  38. The following example moves `my_index` from the initial step to the
  39. `forcemerge` step:
  40. //////////////////////////
  41. [source,console]
  42. --------------------------------------------------
  43. PUT _ilm/policy/my_policy
  44. {
  45. "policy": {
  46. "phases": {
  47. "warm": {
  48. "min_age": "10d",
  49. "actions": {
  50. "forcemerge": {
  51. "max_num_segments": 1
  52. }
  53. }
  54. },
  55. "delete": {
  56. "min_age": "30d",
  57. "actions": {
  58. "delete": {}
  59. }
  60. }
  61. }
  62. }
  63. }
  64. PUT my_index
  65. {
  66. "settings": {
  67. "index.lifecycle.name": "my_policy"
  68. }
  69. }
  70. --------------------------------------------------
  71. //////////////////////////
  72. [source,console]
  73. --------------------------------------------------
  74. POST _ilm/move/my_index
  75. {
  76. "current_step": { <1>
  77. "phase": "new",
  78. "action": "complete",
  79. "name": "complete"
  80. },
  81. "next_step": { <2>
  82. "phase": "warm",
  83. "action": "forcemerge",
  84. "name": "forcemerge"
  85. }
  86. }
  87. --------------------------------------------------
  88. // TEST[continued]
  89. <1> The step that the index is expected to be in
  90. <2> The step that you want to execute
  91. If the request succeeds, you receive the following result:
  92. [source,console-result]
  93. --------------------------------------------------
  94. {
  95. "acknowledged": true
  96. }
  97. --------------------------------------------------
  98. The request will fail if the index is not in the `new` phase as specified
  99. by the `current_step`.