migrate-to-data-tiers.asciidoc 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. [role="xpack"]
  2. [[ilm-migrate-to-data-tiers]]
  3. === Migrate to data tiers routing API
  4. ++++
  5. <titleabbrev>Migrate indices, ILM policies, and legacy, composable and component templates to data tiers routing</titleabbrev>
  6. ++++
  7. .New API reference
  8. [sidebar]
  9. --
  10. For the most up-to-date API details, refer to {api-es}/group/endpoint-ilm[{ilm-cap} APIs].
  11. --
  12. Switches the indices, ILM policies, and legacy, composable and component templates from using <<custom-node-attributes,custom node attributes>> and
  13. <<shard-allocation-filtering, attribute-based allocation filters>> to using <<data-tiers, data tiers>>, and
  14. optionally deletes one legacy index template.
  15. Using node roles enables {ilm-init} to <<data-tier-migration, automatically move the indices>> between
  16. data tiers.
  17. Migrating away from custom node attributes routing can be manually performed
  18. as indicated in the <<migrate-index-allocation-filters, Migrate index allocation
  19. filters to node roles>> page.
  20. This API provides an automated way of executing three out of the four manual steps listed
  21. in the <<migrate-index-allocation-filters, migration guide>>:
  22. . <<stop-setting-custom-hot-attribute, Stop setting the custom hot attribute on new indices>>
  23. . <<remove-custom-allocation-settings, Remove custom allocation settings from existing {ilm-init} policies>>
  24. . <<set-tier-preference, Replace custom allocation settings from existing indices>> with the corresponding <<tier-preference-allocation-filter,tier preference>>
  25. [[ilm-migrate-to-data-tiers-request]]
  26. ==== {api-request-title}
  27. `POST /_ilm/migrate_to_data_tiers`
  28. The API accepts an optional body that allows you to specify:
  29. - The legacy index template name to delete. Defaults to none.
  30. - The name of the custom node attribute used for the indices and ILM policies allocation filtering.
  31. Defaults to `data`.
  32. [[ilm-migrate-to-data-tiers-prereqs]]
  33. ==== {api-prereq-title}
  34. * {ilm-init} must be stopped before performing the migration. Use the <<ilm-stop-request, stop ILM API>>
  35. to stop {ilm-init} and <<ilm-get-status-request, get status API>> to wait until the
  36. reported operation mode is `STOPPED`.
  37. [[ilm-migrate-to-data-tiers-query-params]]
  38. ==== {api-query-parms-title}
  39. `dry_run`::
  40. (Optional, Boolean)
  41. If `true`, simulates the migration from node attributes based allocation filters to data tiers, but does
  42. not perform the migration. This provides a way to retrieve the indices and ILM policies that need to be
  43. migrated.
  44. Defaults to `false`.
  45. NOTE: When simulating a migration (ie. `dry_run` is `true`) {ilm-init} doesn't need to be stopped.
  46. [[ilm-migrate-to-data-tiers-example]]
  47. ==== {api-examples-title}
  48. The following example migrates the indices, ILM policies, legacy templates,
  49. composable, and component templates away from defining custom allocation filtering
  50. using the `custom_attribute_name` node attribute, and deletes the legacy template
  51. with name `global-template` if it exists in the system.
  52. ////
  53. [source,console]
  54. ----
  55. POST _ilm/stop
  56. PUT _template/global-template
  57. {
  58. "index_patterns": ["migrate-to-tiers-*"],
  59. "settings": {
  60. "index.routing.allocation.require.custom_attribute_name": "hot"
  61. }
  62. }
  63. PUT _template/a-legacy-template
  64. {
  65. "index_patterns": ["legacy-template-migrate-to-tiers-*"],
  66. "settings": {
  67. "index.routing.allocation.require.custom_attribute_name": "hot"
  68. }
  69. }
  70. PUT _index_template/a-composable-template
  71. {
  72. "index_patterns": [ "composable-template-migrate-to-tiers-*" ],
  73. "data_stream": {},
  74. "template" : {
  75. "settings": {
  76. "index.routing.allocation.require.custom_attribute_name": "hot"
  77. }
  78. }
  79. }
  80. PUT _component_template/a-component-template
  81. {
  82. "template" : {
  83. "settings": {
  84. "index.routing.allocation.require.custom_attribute_name": "hot"
  85. }
  86. }
  87. }
  88. PUT warm-index-to-migrate-000001
  89. {
  90. "settings": {
  91. "index.routing.allocation.require.custom_attribute_name": "warm"
  92. }
  93. }
  94. PUT _ilm/policy/policy_with_allocate_action
  95. {
  96. "policy": {
  97. "phases": {
  98. "warm": {
  99. "actions": {
  100. "allocate": {
  101. "require": {
  102. "custom_attribute_name": "warm"
  103. }
  104. }
  105. }
  106. },
  107. "delete": {
  108. "min_age": "30d",
  109. "actions": {
  110. "delete": {}
  111. }
  112. }
  113. }
  114. }
  115. }
  116. ----
  117. // TESTSETUP
  118. [source,console]
  119. ----
  120. DELETE warm-index-to-migrate-000001
  121. DELETE _ilm/policy/policy_with_allocate_action
  122. DELETE _template/a-legacy-template
  123. DELETE _index_template/a-composable-template
  124. DELETE _component_template/a-component-template
  125. POST _ilm/start
  126. ----
  127. // TEARDOWN
  128. ////
  129. [source,console]
  130. ----------------------------------------------------------------
  131. POST /_ilm/migrate_to_data_tiers
  132. {
  133. "legacy_template_to_delete": "global-template",
  134. "node_attribute": "custom_attribute_name"
  135. }
  136. ----------------------------------------------------------------
  137. If the request succeeds, a response like the following will be received:
  138. [source,console-result]
  139. ------------------------------------------------------------------------------
  140. {
  141. "dry_run": false,
  142. "removed_legacy_template":"global-template", <1>
  143. "migrated_ilm_policies":["policy_with_allocate_action"], <2>
  144. "migrated_indices":["warm-index-to-migrate-000001"], <3>
  145. "migrated_legacy_templates":["a-legacy-template"], <4>
  146. "migrated_composable_templates":["a-composable-template"], <5>
  147. "migrated_component_templates":["a-component-template"] <6>
  148. }
  149. ------------------------------------------------------------------------------
  150. <1> Shows the name of the legacy index template that was deleted. This will be missing
  151. if no legacy index template was deleted.
  152. <2> The ILM policies that were updated.
  153. <3> The indices that were migrated to <<tier-preference-allocation-filter,tier preference>> routing.
  154. <4> The legacy index templates that were updated to not contain custom routing settings for the
  155. provided data attribute.
  156. <5> The composable index templates that were updated to not contain custom routing settings for the
  157. provided data attribute.
  158. <6> The component templates that were updated to not contain custom routing settings for the
  159. provided data attribute.