@@ -13,6 +13,9 @@ strategies for newly created indices. It is possible to update policy definition
13
13
and an index's `index.lifecycle.name` settings independently. To prevent the situation
14
14
that phase definitions are modified while currently being executed on an index, each index
15
15
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.
16
19
17
20
There are three scenarios for examining the behavior updating policies and
18
21
their effects on policy execution on indices.
@@ -227,7 +230,86 @@ GET my_index/_ilm/explain
227
230
// CONSOLE
228
231
// TESTRESPONSE[skip:no way to know if we will get this response immediately]
229
232
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.
231
313
232
314
[source,js]
233
315
------------------------
@@ -256,8 +338,9 @@ PUT _ilm/policy/my_executing_policy
256
338
// CONSOLE
257
339
// TEST[continued]
258
340
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.
261
344
262
345
////
263
346
[source,js]
@@ -286,7 +369,7 @@ GET my_index/_ilm/explain
286
369
"phase_execution": {
287
370
"policy": "my_executing_policy",
288
371
"modified_date_in_millis": 1538475653317,
289
- "version": 1,
372
+ "version": 1, <1>
290
373
"phase_definition": {
291
374
"min_age": "0ms",
292
375
"actions": {
@@ -302,9 +385,11 @@ GET my_index/_ilm/explain
302
385
--------------------------------------------------
303
386
// CONSOLE
304
387
// 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
305
389
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.
308
393
309
394
////
310
395
[source,js]
@@ -338,7 +423,7 @@ GET my_index/_ilm/explain
338
423
"phase_execution": {
339
424
"policy": "my_executing_policy",
340
425
"modified_date_in_millis": 1538475653317,
341
- "version": 2 , <1>
426
+ "version": 3 , <1>
342
427
"phase_definition": {
343
428
"min_age": "1d",
344
429
"actions": {
@@ -354,7 +439,7 @@ GET my_index/_ilm/explain
354
439
--------------------------------------------------
355
440
// CONSOLE
356
441
// 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
358
443
359
444
`my_index` will move to the next phase in the latest policy definition, which is the newly added `warm` phase.
360
445
0 commit comments