2018-10-26 15:19:52 -04:00
|
|
|
[role="xpack"]
|
|
|
|
[testenv="basic"]
|
2018-08-13 16:15:15 -04:00
|
|
|
[[update-lifecycle-policy]]
|
2018-12-20 13:23:28 -05:00
|
|
|
== Update lifecycle policy
|
2018-11-08 18:26:27 -05:00
|
|
|
++++
|
2018-12-20 13:23:28 -05:00
|
|
|
<titleabbrev>Update policy</titleabbrev>
|
2018-11-08 18:26:27 -05:00
|
|
|
++++
|
2018-08-13 16:15:15 -04:00
|
|
|
|
2018-11-08 18:26:27 -05:00
|
|
|
You can update an existing lifecycle policy to fix mistakes or change
|
2018-10-25 18:24:25 -04:00
|
|
|
strategies for newly created indices. It is possible to update policy definitions
|
|
|
|
and an index's `index.lifecycle.name` settings independently. To prevent the situation
|
|
|
|
that phase definitions are modified while currently being executed on an index, each index
|
|
|
|
will keep the version of the current phase definition it began execution with until it completes.
|
2018-12-21 16:55:21 -05:00
|
|
|
This also means that changes to `min_age` will not be propagated. If a new policy is set that
|
|
|
|
introduces a later `min_age` for the currently executing phase, that new `min_age` will not
|
|
|
|
be picked up by the update.
|
2018-10-25 18:24:25 -04:00
|
|
|
|
|
|
|
There are three scenarios for examining the behavior updating policies and
|
|
|
|
their effects on policy execution on indices.
|
|
|
|
|
|
|
|
=== Updates to policies not managing indices
|
|
|
|
|
|
|
|
Indices not referencing an existing policy that is updated will not be affected.
|
|
|
|
If an index is assigned to the policy, it will be assigned the latest version of that policy
|
|
|
|
|
|
|
|
To show this, let's create a policy `my_policy`.
|
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2018-10-25 18:24:25 -04:00
|
|
|
------------------------
|
2018-10-30 19:19:05 -04:00
|
|
|
PUT _ilm/policy/my_policy
|
2018-10-25 18:24:25 -04:00
|
|
|
{
|
|
|
|
"policy": {
|
|
|
|
"phases": {
|
|
|
|
"hot": {
|
|
|
|
"actions": {
|
|
|
|
"rollover": {
|
|
|
|
"max_size": "25GB"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"delete": {
|
2018-10-30 15:54:02 -04:00
|
|
|
"min_age": "30d",
|
2018-10-25 18:24:25 -04:00
|
|
|
"actions": {
|
|
|
|
"delete": {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
------------------------
|
|
|
|
|
|
|
|
This newly defined policy will be created and assigned to have a version equal
|
|
|
|
to 1. Since we haven't assigned any indices to this policy, any updates that
|
|
|
|
occur will be reflected completely on indices that are newly set to be managed
|
|
|
|
by this policy.
|
|
|
|
|
|
|
|
Updating the Delete phase's minimum age can be done in an update request.
|
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2018-10-25 18:24:25 -04:00
|
|
|
------------------------
|
2018-10-30 19:19:05 -04:00
|
|
|
PUT _ilm/policy/my_policy
|
2018-10-25 18:24:25 -04:00
|
|
|
{
|
|
|
|
"policy": {
|
|
|
|
"phases": {
|
|
|
|
"hot": {
|
|
|
|
"actions": {
|
|
|
|
"rollover": {
|
|
|
|
"max_size": "25GB"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"delete": {
|
2018-10-30 15:54:02 -04:00
|
|
|
"min_age": "10d", <1>
|
2018-10-25 18:24:25 -04:00
|
|
|
"actions": {
|
|
|
|
"delete": {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
------------------------
|
|
|
|
// TEST[continued]
|
2019-09-09 13:38:14 -04:00
|
|
|
|
2018-10-30 15:54:02 -04:00
|
|
|
<1> update `min_age` to 10 days
|
2018-10-25 18:24:25 -04:00
|
|
|
|
|
|
|
//////////
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2018-10-25 18:24:25 -04:00
|
|
|
--------------------------------------------------
|
2019-01-23 12:18:08 -05:00
|
|
|
GET _ilm/policy/my_policy
|
2018-10-25 18:24:25 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[continued]
|
|
|
|
//////////
|
|
|
|
|
|
|
|
When we get the policy, we will see it reflect our latest changes, but
|
|
|
|
with its version bumped to 2.
|
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console-result]
|
2018-10-25 18:24:25 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"my_policy": {
|
|
|
|
"version": 2, <1>
|
|
|
|
"modified_date": 82392349, <2>
|
|
|
|
"policy": {
|
|
|
|
"phases": {
|
|
|
|
"hot": {
|
2018-10-30 15:54:02 -04:00
|
|
|
"min_age": "0ms",
|
2018-10-25 18:24:25 -04:00
|
|
|
"actions": {
|
|
|
|
"rollover": {
|
|
|
|
"max_size": "25gb"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"delete": {
|
2018-10-30 15:54:02 -04:00
|
|
|
"min_age": "10d",
|
2018-10-25 18:24:25 -04:00
|
|
|
"actions": {
|
2020-04-07 07:28:53 -04:00
|
|
|
"delete": {
|
|
|
|
"delete_searchable_snapshot": true
|
|
|
|
}
|
2018-10-25 18:24:25 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// TESTRESPONSE[s/"modified_date": 82392349/"modified_date": $body.my_policy.modified_date/]
|
2019-09-09 13:38:14 -04:00
|
|
|
|
2018-10-25 18:24:25 -04:00
|
|
|
<1> The updated version value
|
|
|
|
<2> The timestamp when this policy was updated last.
|
|
|
|
|
|
|
|
Afterwords, any indices set to `my_policy` will execute against version 2 of
|
|
|
|
the policy.
|
|
|
|
|
|
|
|
=== Updates to executing policies
|
|
|
|
|
|
|
|
Indices preserve the phase definition from the latest policy version that existed
|
|
|
|
at the time that it entered that phase. Changes to the currently-executing phase within policy updates will
|
|
|
|
not be reflected during execution. This means that updates to the `hot` phase, for example, will not affect
|
|
|
|
indices that are currently executing the corresponding `hot` phase.
|
|
|
|
|
|
|
|
Let's say we have an index `my_index` managed by the below `my_executing_policy` definition.
|
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2018-10-25 18:24:25 -04:00
|
|
|
------------------------
|
2018-10-30 19:19:05 -04:00
|
|
|
PUT _ilm/policy/my_executing_policy
|
2018-10-25 18:24:25 -04:00
|
|
|
{
|
|
|
|
"policy": {
|
|
|
|
"phases": {
|
|
|
|
"hot": {
|
|
|
|
"actions": {
|
|
|
|
"rollover": {
|
|
|
|
"max_docs": 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"delete": {
|
2018-10-30 15:54:02 -04:00
|
|
|
"min_age": "10d",
|
2018-10-25 18:24:25 -04:00
|
|
|
"actions": {
|
|
|
|
"delete": {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
------------------------
|
|
|
|
|
|
|
|
////
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2018-10-25 18:24:25 -04:00
|
|
|
------------------------
|
2019-01-18 03:34:11 -05:00
|
|
|
PUT my_index
|
2018-10-25 18:24:25 -04:00
|
|
|
{
|
|
|
|
"settings": {
|
|
|
|
"index.lifecycle.name": "my_executing_policy"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
------------------------
|
|
|
|
// TEST[continued]
|
|
|
|
////
|
|
|
|
|
2018-11-08 18:26:27 -05:00
|
|
|
The <<ilm-explain-lifecycle,Explain API>> is useful to introspect managed indices to see which phase definition they are currently executing.
|
2018-11-15 19:11:31 -05:00
|
|
|
Using this API, we can find out that `my_index` is currently checking if it is ready to be rolled over.
|
2018-10-25 18:24:25 -04:00
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2018-10-25 18:24:25 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
GET my_index/_ilm/explain
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[continued]
|
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console-result]
|
2018-10-25 18:24:25 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"indices": {
|
|
|
|
"my_index": {
|
|
|
|
"index": "my_index",
|
|
|
|
"managed": true,
|
|
|
|
"policy": "my_executing_policy",
|
2018-11-05 10:17:15 -05:00
|
|
|
"lifecycle_date_millis": 1538475653281,
|
Expose index age in ILM explain output (#44457)
* Expose index age in ILM explain output
This adds the index's age to the ILM explain output, for example:
```
{
"indices" : {
"ilm-000001" : {
"index" : "ilm-000001",
"managed" : true,
"policy" : "full-lifecycle",
"lifecycle_date" : "2019-07-16T19:48:22.294Z",
"lifecycle_date_millis" : 1563306502294,
"age" : "1.34m",
"phase" : "hot",
"phase_time" : "2019-07-16T19:48:22.487Z",
... etc ...
}
}
}
```
This age can be used to tell when ILM will transition the index to the
next phase, based on that phase's `min_age`.
Resolves #38988
* Expose age in getters and in HLRC
2019-07-18 17:32:52 -04:00
|
|
|
"age": "30s",
|
2018-10-25 18:24:25 -04:00
|
|
|
"phase": "hot",
|
2018-11-05 10:17:15 -05:00
|
|
|
"phase_time_millis": 1538475653317,
|
2018-10-25 18:24:25 -04:00
|
|
|
"action": "rollover",
|
2018-11-05 10:17:15 -05:00
|
|
|
"action_time_millis": 1538475653317,
|
2018-11-15 19:11:31 -05:00
|
|
|
"step": "check-rollover-ready",
|
2018-11-05 10:17:15 -05:00
|
|
|
"step_time_millis": 1538475653317,
|
2018-10-25 18:24:25 -04:00
|
|
|
"phase_execution": {
|
|
|
|
"policy": "my_executing_policy",
|
|
|
|
"modified_date_in_millis": 1538475653317,
|
|
|
|
"version": 1,
|
|
|
|
"phase_definition": {
|
2018-10-30 15:54:02 -04:00
|
|
|
"min_age": "0ms",
|
2018-10-25 18:24:25 -04:00
|
|
|
"actions": {
|
|
|
|
"rollover": {
|
|
|
|
"max_docs": 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
2018-11-14 19:45:06 -05:00
|
|
|
// TESTRESPONSE[skip:no way to know if we will get this response immediately]
|
2018-10-25 18:24:25 -04:00
|
|
|
|
2018-12-21 16:55:21 -05:00
|
|
|
We can update `my_executing_policy` to enter the hot phase after one day.
|
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2018-12-21 16:55:21 -05:00
|
|
|
------------------------
|
|
|
|
PUT _ilm/policy/my_executing_policy
|
|
|
|
{
|
|
|
|
"policy": {
|
|
|
|
"phases": {
|
|
|
|
"hot": {
|
|
|
|
"min_age": "1d", <1>
|
|
|
|
"actions": {
|
|
|
|
"rollover": {
|
|
|
|
"max_docs": 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"delete": {
|
|
|
|
"min_age": "10d",
|
|
|
|
"actions": {
|
|
|
|
"delete": {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
------------------------
|
|
|
|
// TEST[continued]
|
2019-09-09 13:38:14 -04:00
|
|
|
|
2018-12-21 16:55:21 -05:00
|
|
|
<1> updated `min_age` from "0ms" to "1d"
|
|
|
|
|
|
|
|
The index `my_index` has already entered the hot phase, so it will still
|
|
|
|
use version 1 of the policy until it completes the hot phase.
|
|
|
|
|
|
|
|
////
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2018-12-21 16:55:21 -05:00
|
|
|
--------------------------------------------------
|
|
|
|
GET my_index/_ilm/explain
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[continued]
|
|
|
|
////
|
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console-result]
|
2018-12-21 16:55:21 -05:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"indices": {
|
|
|
|
"my_index": {
|
|
|
|
"index": "my_index",
|
|
|
|
"managed": true,
|
|
|
|
"policy": "my_executing_policy",
|
|
|
|
"lifecycle_date_millis": 1538475653281,
|
Expose index age in ILM explain output (#44457)
* Expose index age in ILM explain output
This adds the index's age to the ILM explain output, for example:
```
{
"indices" : {
"ilm-000001" : {
"index" : "ilm-000001",
"managed" : true,
"policy" : "full-lifecycle",
"lifecycle_date" : "2019-07-16T19:48:22.294Z",
"lifecycle_date_millis" : 1563306502294,
"age" : "1.34m",
"phase" : "hot",
"phase_time" : "2019-07-16T19:48:22.487Z",
... etc ...
}
}
}
```
This age can be used to tell when ILM will transition the index to the
next phase, based on that phase's `min_age`.
Resolves #38988
* Expose age in getters and in HLRC
2019-07-18 17:32:52 -04:00
|
|
|
"age": "30s",
|
2018-12-21 16:55:21 -05:00
|
|
|
"phase": "hot",
|
|
|
|
"phase_time_millis": 1538475653317,
|
|
|
|
"action": "rollover",
|
|
|
|
"action_time_millis": 1538475653317,
|
|
|
|
"step": "check-rollover-ready",
|
|
|
|
"step_time_millis": 1538475653317,
|
|
|
|
"phase_execution": {
|
|
|
|
"policy": "my_executing_policy",
|
|
|
|
"modified_date_in_millis": 1538475653317,
|
|
|
|
"version": 1, <1>
|
|
|
|
"phase_definition": {
|
|
|
|
"min_age": "0ms",
|
|
|
|
"actions": {
|
|
|
|
"rollover": {
|
|
|
|
"max_docs": 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// TESTRESPONSE[skip:no way to know if we will get this response immediately]
|
2019-09-09 13:38:14 -04:00
|
|
|
|
2018-12-21 16:55:21 -05:00
|
|
|
<1> the version of the policy used for executing the hot phase
|
|
|
|
|
|
|
|
We can also update `my_executing_policy` to have no rollover action and,
|
|
|
|
instead, go directly into a newly introduced `warm` phase.
|
2018-10-25 18:24:25 -04:00
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2018-10-25 18:24:25 -04:00
|
|
|
------------------------
|
2018-10-30 19:19:05 -04:00
|
|
|
PUT _ilm/policy/my_executing_policy
|
2018-10-25 18:24:25 -04:00
|
|
|
{
|
|
|
|
"policy": {
|
|
|
|
"phases": {
|
|
|
|
"warm": {
|
2018-10-30 15:54:02 -04:00
|
|
|
"min_age": "1d",
|
2018-10-25 18:24:25 -04:00
|
|
|
"actions": {
|
|
|
|
"forcemerge": {
|
|
|
|
"max_num_segments": 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"delete": {
|
2018-10-30 15:54:02 -04:00
|
|
|
"min_age": "10d",
|
2018-10-25 18:24:25 -04:00
|
|
|
"actions": {
|
|
|
|
"delete": {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
------------------------
|
|
|
|
// TEST[continued]
|
|
|
|
|
2018-12-21 16:55:21 -05:00
|
|
|
Now, version 3 of this policy has no `hot` phase, but if we run the
|
|
|
|
Explain API again, we will see that nothing has changed. The index
|
|
|
|
`my_index` is still executing version 1 of the policy.
|
2018-10-25 18:24:25 -04:00
|
|
|
|
|
|
|
////
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2018-10-25 18:24:25 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
GET my_index/_ilm/explain
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[continued]
|
|
|
|
////
|
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console-result]
|
2018-10-25 18:24:25 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"indices": {
|
|
|
|
"my_index": {
|
|
|
|
"index": "my_index",
|
|
|
|
"managed": true,
|
|
|
|
"policy": "my_executing_policy",
|
2018-11-05 10:17:15 -05:00
|
|
|
"lifecycle_date_millis": 1538475653281,
|
Expose index age in ILM explain output (#44457)
* Expose index age in ILM explain output
This adds the index's age to the ILM explain output, for example:
```
{
"indices" : {
"ilm-000001" : {
"index" : "ilm-000001",
"managed" : true,
"policy" : "full-lifecycle",
"lifecycle_date" : "2019-07-16T19:48:22.294Z",
"lifecycle_date_millis" : 1563306502294,
"age" : "1.34m",
"phase" : "hot",
"phase_time" : "2019-07-16T19:48:22.487Z",
... etc ...
}
}
}
```
This age can be used to tell when ILM will transition the index to the
next phase, based on that phase's `min_age`.
Resolves #38988
* Expose age in getters and in HLRC
2019-07-18 17:32:52 -04:00
|
|
|
"age": "30s",
|
2018-10-25 18:24:25 -04:00
|
|
|
"phase": "hot",
|
2018-11-05 10:17:15 -05:00
|
|
|
"phase_time_millis": 1538475653317,
|
2018-10-25 18:24:25 -04:00
|
|
|
"action": "rollover",
|
2018-11-05 10:17:15 -05:00
|
|
|
"action_time_millis": 1538475653317,
|
2018-11-15 19:11:31 -05:00
|
|
|
"step": "check-rollover-ready",
|
2018-11-05 10:17:15 -05:00
|
|
|
"step_time_millis": 1538475653317,
|
2018-10-25 18:24:25 -04:00
|
|
|
"phase_execution": {
|
|
|
|
"policy": "my_executing_policy",
|
|
|
|
"modified_date_in_millis": 1538475653317,
|
2018-12-21 16:55:21 -05:00
|
|
|
"version": 1, <1>
|
2018-10-25 18:24:25 -04:00
|
|
|
"phase_definition": {
|
2018-10-30 15:54:02 -04:00
|
|
|
"min_age": "0ms",
|
2018-10-25 18:24:25 -04:00
|
|
|
"actions": {
|
|
|
|
"rollover": {
|
|
|
|
"max_docs": 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
2018-11-25 20:19:17 -05:00
|
|
|
// TESTRESPONSE[skip:no way to know if we will get this response immediately]
|
2019-09-09 13:38:14 -04:00
|
|
|
|
2018-12-21 16:55:21 -05:00
|
|
|
<1> the version of the policy used for executing the hot phase
|
2018-10-25 18:24:25 -04:00
|
|
|
|
2018-12-21 16:55:21 -05:00
|
|
|
After indexing one document into `my_index` so that rollover succeeds and
|
|
|
|
moves onto the next phase, we will notice something new. The index will
|
|
|
|
move into the next phase in the updated version 3 of its policy.
|
2018-10-25 18:24:25 -04:00
|
|
|
|
|
|
|
////
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2018-10-25 18:24:25 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
PUT my_index/_doc/1
|
|
|
|
{
|
|
|
|
"foo": "bar"
|
|
|
|
}
|
|
|
|
|
|
|
|
GET my_index/_ilm/explain
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[continued]
|
|
|
|
////
|
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console-result]
|
2018-10-25 18:24:25 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"indices": {
|
|
|
|
"my_index": {
|
|
|
|
"index": "my_index",
|
|
|
|
"managed": true,
|
|
|
|
"policy": "my_executing_policy",
|
2018-11-05 10:17:15 -05:00
|
|
|
"lifecycle_date_millis": 1538475653281,
|
Expose index age in ILM explain output (#44457)
* Expose index age in ILM explain output
This adds the index's age to the ILM explain output, for example:
```
{
"indices" : {
"ilm-000001" : {
"index" : "ilm-000001",
"managed" : true,
"policy" : "full-lifecycle",
"lifecycle_date" : "2019-07-16T19:48:22.294Z",
"lifecycle_date_millis" : 1563306502294,
"age" : "1.34m",
"phase" : "hot",
"phase_time" : "2019-07-16T19:48:22.487Z",
... etc ...
}
}
}
```
This age can be used to tell when ILM will transition the index to the
next phase, based on that phase's `min_age`.
Resolves #38988
* Expose age in getters and in HLRC
2019-07-18 17:32:52 -04:00
|
|
|
"age": "30s",
|
2018-10-25 18:24:25 -04:00
|
|
|
"phase": "warm",
|
2018-11-05 10:17:15 -05:00
|
|
|
"phase_time_millis": 1538475653317,
|
2018-10-25 18:24:25 -04:00
|
|
|
"action": "forcemerge",
|
2018-11-05 10:17:15 -05:00
|
|
|
"action_time_millis": 1538475653317,
|
2018-10-25 18:24:25 -04:00
|
|
|
"step": "forcemerge",
|
2018-11-05 10:17:15 -05:00
|
|
|
"step_time_millis": 1538475653317,
|
2018-10-25 18:24:25 -04:00
|
|
|
"phase_execution": {
|
|
|
|
"policy": "my_executing_policy",
|
|
|
|
"modified_date_in_millis": 1538475653317,
|
2018-12-21 16:55:21 -05:00
|
|
|
"version": 3, <1>
|
2018-10-25 18:24:25 -04:00
|
|
|
"phase_definition": {
|
2018-10-30 15:54:02 -04:00
|
|
|
"min_age": "1d",
|
2018-10-25 18:24:25 -04:00
|
|
|
"actions": {
|
|
|
|
"forcemerge": {
|
|
|
|
"max_num_segments": 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// TESTRESPONSE[skip:There is no way to force the index to move to the next step in a timely manner]
|
2019-09-09 13:38:14 -04:00
|
|
|
|
2018-12-21 16:55:21 -05:00
|
|
|
<1> The index has moved to using version 3 of the policy
|
2018-10-25 18:24:25 -04:00
|
|
|
|
|
|
|
`my_index` will move to the next phase in the latest policy definition, which is the newly added `warm` phase.
|
|
|
|
|
|
|
|
=== Switching policies for an index
|
|
|
|
|
|
|
|
Setting `index.lifecycle.name` to a different policy behaves much like a policy update, but instead of just
|
|
|
|
switching to a different version, it switches to a different policy.
|
|
|
|
|
|
|
|
After setting a policy for an index, we can switch out `my_policy` with
|
|
|
|
`my_other_policy` by just updating the index's `index.lifecycle.name`
|
|
|
|
setting to the new policy. After completing its currently executed phase,
|
|
|
|
it will move on to the next phase in `my_other_policy`. So if it was on the
|
|
|
|
`hot` phase before, it will move to the `delete` phase after the `hot` phase concluded.
|
|
|
|
|
|
|
|
////
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2018-10-25 18:24:25 -04:00
|
|
|
------------------------
|
2018-10-30 19:19:05 -04:00
|
|
|
PUT _ilm/policy/my_policy
|
2018-10-25 18:24:25 -04:00
|
|
|
{
|
|
|
|
"policy": {
|
|
|
|
"phases": {
|
|
|
|
"hot": {
|
|
|
|
"actions": {
|
|
|
|
"rollover": {
|
|
|
|
"max_size": "25GB"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"delete": {
|
2018-10-30 15:54:02 -04:00
|
|
|
"min_age": "10d",
|
2018-10-25 18:24:25 -04:00
|
|
|
"actions": {
|
|
|
|
"delete": {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-30 19:19:05 -04:00
|
|
|
PUT _ilm/policy/my_other_policy
|
2018-10-25 18:24:25 -04:00
|
|
|
{
|
|
|
|
"policy": {
|
|
|
|
"phases": {
|
|
|
|
"delete": {
|
2018-10-30 15:54:02 -04:00
|
|
|
"min_age": "1d",
|
2018-10-25 18:24:25 -04:00
|
|
|
"actions": {
|
|
|
|
"delete": {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-18 03:34:11 -05:00
|
|
|
PUT my_index
|
2018-10-25 18:24:25 -04:00
|
|
|
{
|
|
|
|
"settings": {
|
|
|
|
"index.lifecycle.name": "my_policy"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
------------------------
|
|
|
|
|
|
|
|
////
|
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2018-10-25 18:24:25 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
PUT my_index/_settings
|
|
|
|
{
|
|
|
|
"lifecycle.name": "my_other_policy"
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[continued]
|
|
|
|
|
|
|
|
The change to the new policy will not happen immediately. The currently executing phase
|
|
|
|
of the existing policy for `my_index` will continue to execute until it completes. Once
|
|
|
|
completed, `my_index` will move to being managed by the `my_other_policy`.
|