Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] Document how to switch ILM policies #73967

Merged
merged 2 commits into from
Jun 28, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add step to check index state
jrodewig committed Jun 28, 2021
commit c96eb52d9a090bec68de0a76615dbe034f75145c
46 changes: 39 additions & 7 deletions docs/reference/ilm/set-up-lifecycle-policy.asciidoc
Original file line number Diff line number Diff line change
@@ -273,22 +273,53 @@ PUT mylogs-pre-ilm*/_settings <1>
[[switch-lifecycle-policies]]
==== Switch lifecycle policies

To switch an index's lifecycle policy, first use the <<ilm-remove-policy,remove
policy API>> to remove the existing policy. Target a data stream or alias to
remove the policies of all its indices.

WARNING: Don't assign a new policy without first removing the existing policy.
This can cause <<ilm-phase-execution,phase execution>> to silently fail.
To switch an index's lifecycle policy, follow these steps:

. Remove the existing policy using the <<ilm-remove-policy,remove policy API>>.
Target a data stream or alias to remove the policies of all its indices.
+
[source,console]
----
POST logs-my_app-default/_ilm/remove
----
// TEST[continued]
// TEST[s/^/PUT _data_stream\/logs-my_app-default\n/]

Then use <<indices-update-settings,update settings API>> to assign a new policy.
. The remove policy API removes all {ilm-init} metadata from the index and
doesn't consider the index's lifecycle status. This can leave indices in an
undesired state.
+
--
For example, the <<ilm-forcemerge,`forcemerge`>> action temporarily closes an
index before reopening it. Removing an index's {ilm-init} policy during a
`forcemerge` can leave the index closed indefinitely.

After policy removal, use the <<indices-get-index,get index API>> to check an
index's state . Target a data stream or alias to get the state of all its
indices.

[source,console]
----
GET logs-my_app-default
----
// TEST[continued]

You can then change the index as needed. For example, you can re-open any
closed indices using the <<indices-open-close,open index API>>.

[source,console]
----
POST logs-my_app-default/_open
----
// TEST[continued]
--

. Assign a new policy using the <<indices-update-settings,update settings API>>.
Target a data stream or alias to assign a policy to all its indices.
+
--
WARNING: Don't assign a new policy without first removing the existing policy.
This can cause <<ilm-phase-execution,phase execution>> to silently fail.

[source,console]
----
@@ -303,3 +334,4 @@ PUT logs-my_app-default/_settings
----
// TEST[continued]
// TEST[s/new-lifecycle-policy/mylogs_policy_existing/]
--