Skip to content

Commit 4fd921f

Browse files
committed
[ILM][DOCS] add extra scenario to policy update docs (#36871)
This extra scenario describes the case where an updated policy increases the current phase's `min_age`. Now, the docs explicitly describe this scenario as to what is expected -- old min_age is used. Closes #35356.
1 parent ea1239c commit 4fd921f

File tree

1 file changed

+93
-8
lines changed

1 file changed

+93
-8
lines changed

docs/reference/ilm/update-lifecycle-policy.asciidoc

Lines changed: 93 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ strategies for newly created indices. It is possible to update policy definition
1313
and an index's `index.lifecycle.name` settings independently. To prevent the situation
1414
that phase definitions are modified while currently being executed on an index, each index
1515
will keep the version of the current phase definition it began execution with until it completes.
16+
This also means that changes to `min_age` will not be propagated. If a new policy is set that
17+
introduces a later `min_age` for the currently executing phase, that new `min_age` will not
18+
be picked up by the update.
1619

1720
There are three scenarios for examining the behavior updating policies and
1821
their effects on policy execution on indices.
@@ -227,7 +230,86 @@ GET my_index/_ilm/explain
227230
// CONSOLE
228231
// TESTRESPONSE[skip:no way to know if we will get this response immediately]
229232

230-
Updating `my_executing_policy` to have no rollover action and, instead, go directly into a newly introduced `warm` phase.
233+
We can update `my_executing_policy` to enter the hot phase after one day.
234+
235+
[source,js]
236+
------------------------
237+
PUT _ilm/policy/my_executing_policy
238+
{
239+
"policy": {
240+
"phases": {
241+
"hot": {
242+
"min_age": "1d", <1>
243+
"actions": {
244+
"rollover": {
245+
"max_docs": 1
246+
}
247+
}
248+
},
249+
"delete": {
250+
"min_age": "10d",
251+
"actions": {
252+
"delete": {}
253+
}
254+
}
255+
}
256+
}
257+
}
258+
------------------------
259+
// CONSOLE
260+
// TEST[continued]
261+
<1> updated `min_age` from "0ms" to "1d"
262+
263+
The index `my_index` has already entered the hot phase, so it will still
264+
use version 1 of the policy until it completes the hot phase.
265+
266+
////
267+
[source,js]
268+
--------------------------------------------------
269+
GET my_index/_ilm/explain
270+
--------------------------------------------------
271+
// CONSOLE
272+
// TEST[continued]
273+
////
274+
275+
[source,js]
276+
--------------------------------------------------
277+
{
278+
"indices": {
279+
"my_index": {
280+
"index": "my_index",
281+
"managed": true,
282+
"policy": "my_executing_policy",
283+
"lifecycle_date_millis": 1538475653281,
284+
"phase": "hot",
285+
"phase_time_millis": 1538475653317,
286+
"action": "rollover",
287+
"action_time_millis": 1538475653317,
288+
"step": "check-rollover-ready",
289+
"step_time_millis": 1538475653317,
290+
"phase_execution": {
291+
"policy": "my_executing_policy",
292+
"modified_date_in_millis": 1538475653317,
293+
"version": 1, <1>
294+
"phase_definition": {
295+
"min_age": "0ms",
296+
"actions": {
297+
"rollover": {
298+
"max_docs": 1
299+
}
300+
}
301+
}
302+
}
303+
}
304+
}
305+
}
306+
--------------------------------------------------
307+
// CONSOLE
308+
// TESTRESPONSE[skip:no way to know if we will get this response immediately]
309+
<1> the version of the policy used for executing the hot phase
310+
311+
We can also update `my_executing_policy` to have no rollover action and,
312+
instead, go directly into a newly introduced `warm` phase.
231313

232314
[source,js]
233315
------------------------
@@ -256,8 +338,9 @@ PUT _ilm/policy/my_executing_policy
256338
// CONSOLE
257339
// TEST[continued]
258340

259-
Now, version 2 of this policy has no `hot` phase, but if we run the Explain API again, we will see that nothing has changed.
260-
The index `my_index` is still executing version 1 of the policy.
341+
Now, version 3 of this policy has no `hot` phase, but if we run the
342+
Explain API again, we will see that nothing has changed. The index
343+
`my_index` is still executing version 1 of the policy.
261344

262345
////
263346
[source,js]
@@ -286,7 +369,7 @@ GET my_index/_ilm/explain
286369
"phase_execution": {
287370
"policy": "my_executing_policy",
288371
"modified_date_in_millis": 1538475653317,
289-
"version": 1,
372+
"version": 1, <1>
290373
"phase_definition": {
291374
"min_age": "0ms",
292375
"actions": {
@@ -302,9 +385,11 @@ GET my_index/_ilm/explain
302385
--------------------------------------------------
303386
// CONSOLE
304387
// TESTRESPONSE[skip:no way to know if we will get this response immediately]
388+
<1> the version of the policy used for executing the hot phase
305389

306-
After indexing one document into `my_index` so that rollover succeeds and moves onto the next phase, we will notice something new. The
307-
index will move into the next phase in the updated version 2 of its policy.
390+
After indexing one document into `my_index` so that rollover succeeds and
391+
moves onto the next phase, we will notice something new. The index will
392+
move into the next phase in the updated version 3 of its policy.
308393

309394
////
310395
[source,js]
@@ -338,7 +423,7 @@ GET my_index/_ilm/explain
338423
"phase_execution": {
339424
"policy": "my_executing_policy",
340425
"modified_date_in_millis": 1538475653317,
341-
"version": 2, <1>
426+
"version": 3, <1>
342427
"phase_definition": {
343428
"min_age": "1d",
344429
"actions": {
@@ -354,7 +439,7 @@ GET my_index/_ilm/explain
354439
--------------------------------------------------
355440
// CONSOLE
356441
// TESTRESPONSE[skip:There is no way to force the index to move to the next step in a timely manner]
357-
<1> The index has moved to using version 2 of the policy
442+
<1> The index has moved to using version 3 of the policy
358443

359444
`my_index` will move to the next phase in the latest policy definition, which is the newly added `warm` phase.
360445

0 commit comments

Comments
 (0)