2018-10-16 15:18:54 -04:00
|
|
|
[role="xpack"]
|
|
|
|
[testenv="basic"]
|
2018-11-08 18:26:27 -05:00
|
|
|
[[ilm-explain-lifecycle]]
|
2018-12-20 13:23:28 -05:00
|
|
|
=== Explain lifecycle API
|
2018-10-16 15:18:54 -04:00
|
|
|
++++
|
2018-12-20 13:23:28 -05:00
|
|
|
<titleabbrev>Explain lifecycle</titleabbrev>
|
2018-10-16 15:18:54 -04:00
|
|
|
++++
|
|
|
|
|
2018-11-08 18:26:27 -05:00
|
|
|
Shows an index's current lifecycle status.
|
2018-10-16 15:18:54 -04:00
|
|
|
|
|
|
|
==== Request
|
|
|
|
|
|
|
|
`GET <index>/_ilm/explain`
|
|
|
|
|
|
|
|
==== Description
|
|
|
|
|
2018-11-08 18:26:27 -05:00
|
|
|
Retrieves information about the index's current lifecycle state, such as
|
|
|
|
the currently executing phase, action, and step. Shows when the index entered
|
|
|
|
each one, the definition of the running phase, and information
|
|
|
|
about any failures.
|
2018-10-16 15:18:54 -04:00
|
|
|
|
|
|
|
==== Path Parameters
|
|
|
|
|
|
|
|
`index` (required)::
|
|
|
|
(string) Identifier for the index.
|
|
|
|
|
|
|
|
==== Request Parameters
|
|
|
|
|
2019-07-26 11:57:38 -04:00
|
|
|
`only_managed`::
|
|
|
|
(boolean) Filters the returned indices to only indices that are managed by
|
|
|
|
ILM.
|
|
|
|
|
|
|
|
`only_errors`::
|
|
|
|
(boolean) Filters the returned indices to only indices that are managed by
|
|
|
|
ILM and are in an error state, either due to an encountering an error while
|
|
|
|
executing the policy, or attempting to use a policy that does not exist.
|
|
|
|
|
2019-08-02 08:42:33 -04:00
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
|
2018-10-16 15:18:54 -04:00
|
|
|
|
2018-11-08 18:26:27 -05:00
|
|
|
==== Authorization
|
2018-10-16 15:18:54 -04:00
|
|
|
|
2018-12-18 12:53:25 -05:00
|
|
|
You must have the `view_index_metadata` or `manage_ilm` or both privileges on the indices
|
|
|
|
being managed to use this API.
|
2019-10-07 18:23:19 -04:00
|
|
|
For more information, see <<security-privileges>>.
|
2018-10-16 15:18:54 -04:00
|
|
|
|
|
|
|
==== Examples
|
|
|
|
|
2018-11-08 18:26:27 -05:00
|
|
|
The following example retrieves the lifecycle state of `my_index`:
|
2018-10-16 15:18:54 -04:00
|
|
|
|
|
|
|
//////////////////////////
|
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2018-10-16 15:18:54 -04:00
|
|
|
--------------------------------------------------
|
2018-10-30 19:19:05 -04:00
|
|
|
PUT _ilm/policy/my_policy
|
2018-10-16 15:18:54 -04:00
|
|
|
{
|
|
|
|
"policy": {
|
|
|
|
"phases": {
|
|
|
|
"warm": {
|
2018-10-30 15:54:02 -04:00
|
|
|
"min_age": "10d",
|
2018-10-16 15:18:54 -04:00
|
|
|
"actions": {
|
|
|
|
"forcemerge": {
|
|
|
|
"max_num_segments": 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"delete": {
|
2018-10-30 15:54:02 -04:00
|
|
|
"min_age": "30d",
|
2018-10-16 15:18:54 -04:00
|
|
|
"actions": {
|
|
|
|
"delete": {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-18 03:34:11 -05:00
|
|
|
PUT my_index
|
2018-10-16 15:18:54 -04:00
|
|
|
{
|
|
|
|
"settings": {
|
|
|
|
"index.lifecycle.name": "my_policy",
|
|
|
|
"index.number_of_replicas": 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GET /_cluster/health?wait_for_status=green&timeout=10s
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST
|
|
|
|
|
|
|
|
//////////////////////////
|
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2018-10-16 15:18:54 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
GET my_index/_ilm/explain
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[continued]
|
|
|
|
|
2018-11-08 18:26:27 -05:00
|
|
|
When management of the index is first taken over by ILM, `explain` shows
|
|
|
|
that the index is managed and in the `new` phase:
|
2018-10-16 15:18:54 -04:00
|
|
|
|
2019-09-20 12:20:12 -04:00
|
|
|
[source,console-result]
|
2018-10-16 15:18:54 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"indices": {
|
|
|
|
"my_index": {
|
|
|
|
"index": "my_index",
|
|
|
|
"managed": true, <1>
|
|
|
|
"policy": "my_policy", <2>
|
2018-11-05 10:17:15 -05:00
|
|
|
"lifecycle_date_millis": 1538475653281, <3>
|
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": "15s", <4>
|
2018-11-08 18:26:27 -05:00
|
|
|
"phase": "new",
|
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
|
|
|
"phase_time_millis": 1538475653317, <5>
|
2018-11-08 18:26:27 -05:00
|
|
|
"action": "complete",
|
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
|
|
|
"action_time_millis": 1538475653317, <6>
|
2018-11-08 18:26:27 -05:00
|
|
|
"step": "complete",
|
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
|
|
|
"step_time_millis": 1538475653317 <7>
|
2018-10-16 15:18:54 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
2018-11-14 19:45:06 -05:00
|
|
|
// TESTRESPONSE[skip:no way to know if we will get this response immediately]
|
2019-09-09 13:38:14 -04:00
|
|
|
|
2018-10-16 15:18:54 -04:00
|
|
|
<1> Shows if the index is being managed by ILM. If the index is not managed by
|
|
|
|
ILM the other fields will not be shown
|
|
|
|
<2> The name of the policy which ILM is using for this index
|
2018-10-30 15:54:02 -04:00
|
|
|
<3> The timestamp used for the `min_age`
|
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
|
|
|
<4> The age of the index (used for calculating when to enter the next phase)
|
|
|
|
<5> When the index entered the current phase
|
|
|
|
<6> When the index entered the current action
|
|
|
|
<7> When the index entered the current step
|
2018-10-16 15:18:54 -04:00
|
|
|
|
2018-11-08 18:26:27 -05:00
|
|
|
Once the policy is running on the index, the response includes a
|
|
|
|
`phase_execution` object that shows the definition of the current phase.
|
2018-10-16 15:18:54 -04:00
|
|
|
Changes to the underlying policy will not affect this index until the current
|
2018-11-08 18:26:27 -05:00
|
|
|
phase completes.
|
2018-10-16 15:18:54 -04:00
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console-result]
|
2018-10-16 15:18:54 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"indices": {
|
|
|
|
"test-000069": {
|
|
|
|
"index": "test-000069",
|
|
|
|
"managed": true,
|
|
|
|
"policy": "my_lifecycle3",
|
2018-11-05 10:17:15 -05:00
|
|
|
"lifecycle_date_millis": 1538475653281,
|
2018-10-16 15:18:54 -04:00
|
|
|
"lifecycle_date": "2018-10-15T13:45:21.981Z",
|
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": "25.14s",
|
2018-10-16 15:18:54 -04:00
|
|
|
"phase": "hot",
|
2018-11-05 10:17:15 -05:00
|
|
|
"phase_time_millis": 1538475653317,
|
2018-10-16 15:18:54 -04:00
|
|
|
"phase_time": "2018-10-15T13:45:22.577Z",
|
|
|
|
"action": "rollover",
|
2018-11-05 10:17:15 -05:00
|
|
|
"action_time_millis": 1538475653317,
|
2018-10-16 15:18:54 -04:00
|
|
|
"action_time": "2018-10-15T13:45:22.577Z",
|
2018-11-16 19:42:48 -05:00
|
|
|
"step": "attempt-rollover",
|
2018-11-05 10:17:15 -05:00
|
|
|
"step_time_millis": 1538475653317,
|
2018-10-16 15:18:54 -04:00
|
|
|
"step_time": "2018-10-15T13:45:22.577Z",
|
2018-11-08 18:26:27 -05:00
|
|
|
"phase_execution": {
|
|
|
|
"policy": "my_lifecycle3",
|
|
|
|
"phase_definition": { <1>
|
2018-10-30 15:54:02 -04:00
|
|
|
"min_age": "0ms",
|
2018-10-16 15:18:54 -04:00
|
|
|
"actions": {
|
|
|
|
"rollover": {
|
|
|
|
"max_age": "30s"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2018-11-08 18:26:27 -05:00
|
|
|
"version": 3, <2>
|
|
|
|
"modified_date": "2018-10-15T13:21:41.576Z", <3>
|
|
|
|
"modified_date_in_millis": 1539609701576 <4>
|
2018-10-16 15:18:54 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// TESTRESPONSE[skip:not possible to get the cluster into this state in a docs test]
|
2019-09-09 13:38:14 -04:00
|
|
|
|
2018-11-08 18:26:27 -05:00
|
|
|
<1> The JSON phase definition loaded from the specified policy when the index
|
|
|
|
entered this phase
|
|
|
|
<2> The version of the policy that was loaded
|
|
|
|
<3> The date the loaded policy was last modified
|
|
|
|
<4> The epoch time when the loaded policy was last modified
|
2018-10-16 15:18:54 -04:00
|
|
|
|
2018-12-20 16:34:11 -05:00
|
|
|
If {ilm-init} is waiting for a step to complete, the response includes status
|
2018-11-08 18:26:27 -05:00
|
|
|
information for the step that's being performed on the index.
|
2018-10-16 15:18:54 -04:00
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console-result]
|
2018-10-16 15:18:54 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"indices": {
|
|
|
|
"test-000020": {
|
|
|
|
"index": "test-000020",
|
|
|
|
"managed": true,
|
|
|
|
"policy": "my_lifecycle3",
|
2018-11-05 10:17:15 -05:00
|
|
|
"lifecycle_date_millis": 1538475653281,
|
|
|
|
"lifecycle_date": "2018-10-15T13:45:21.981Z",
|
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": "4.12m",
|
2018-10-16 15:18:54 -04:00
|
|
|
"phase": "warm",
|
2018-11-05 10:17:15 -05:00
|
|
|
"phase_time_millis": 1538475653317,
|
|
|
|
"phase_time": "2018-10-15T13:45:22.577Z",
|
2018-10-16 15:18:54 -04:00
|
|
|
"action": "allocate",
|
2018-11-05 10:17:15 -05:00
|
|
|
"action_time_millis": 1538475653317,
|
|
|
|
"action_time": "2018-10-15T13:45:22.577Z",
|
2018-10-16 15:18:54 -04:00
|
|
|
"step": "check-allocation",
|
2018-11-05 10:17:15 -05:00
|
|
|
"step_time_millis": 1538475653317,
|
|
|
|
"step_time": "2018-10-15T13:45:22.577Z",
|
2018-10-16 15:18:54 -04:00
|
|
|
"step_info": { <1>
|
|
|
|
"message": "Waiting for all shard copies to be active",
|
|
|
|
"shards_left_to_allocate": -1,
|
|
|
|
"all_shards_active": false,
|
|
|
|
"actual_replicas": 2
|
|
|
|
},
|
|
|
|
"phase_execution": {
|
|
|
|
"policy": "my_lifecycle3",
|
|
|
|
"phase_definition": {
|
2018-10-30 15:54:02 -04:00
|
|
|
"min_age": "0ms",
|
2018-10-16 15:18:54 -04:00
|
|
|
"actions": {
|
|
|
|
"allocate": {
|
|
|
|
"number_of_replicas": 2,
|
|
|
|
"include": {
|
|
|
|
"box_type": "warm"
|
|
|
|
},
|
|
|
|
"exclude": {},
|
|
|
|
"require": {}
|
|
|
|
},
|
|
|
|
"forcemerge": {
|
|
|
|
"max_num_segments": 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"version": 2,
|
|
|
|
"modified_date": "2018-10-15T13:20:02.489Z",
|
|
|
|
"modified_date_in_millis": 1539609602489
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// TESTRESPONSE[skip:not possible to get the cluster into this state in a docs test]
|
2019-09-09 13:38:14 -04:00
|
|
|
|
2018-11-08 18:26:27 -05:00
|
|
|
<1> Status of the step that's in progress.
|
2018-10-16 15:18:54 -04:00
|
|
|
|
2018-11-08 18:26:27 -05:00
|
|
|
If the index is in the ERROR step, something went wrong while executing a
|
2019-04-25 14:47:03 -04:00
|
|
|
step in the policy and you will need to take action for the index to proceed
|
2019-10-31 07:28:55 -04:00
|
|
|
to the next step. Some steps are safe to automatically be retried in certain
|
|
|
|
circumstances. To help you diagnose the problem, the explain response shows
|
|
|
|
the step that failed, the step info which provides information about the error,
|
|
|
|
and information about the retry attempts executed for the failed step if it's
|
|
|
|
the case.
|
2018-10-16 15:18:54 -04:00
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console-result]
|
2018-10-16 15:18:54 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"indices": {
|
|
|
|
"test-000056": {
|
|
|
|
"index": "test-000056",
|
|
|
|
"managed": true,
|
|
|
|
"policy": "my_lifecycle3",
|
2018-11-05 10:17:15 -05:00
|
|
|
"lifecycle_date_millis": 1538475653281,
|
|
|
|
"lifecycle_date": "2018-10-15T13:45:21.981Z",
|
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": "50.1d",
|
2018-10-16 15:18:54 -04:00
|
|
|
"phase": "hot",
|
2018-11-05 10:17:15 -05:00
|
|
|
"phase_time_millis": 1538475653317,
|
|
|
|
"phase_time": "2018-10-15T13:45:22.577Z",
|
2018-10-16 15:18:54 -04:00
|
|
|
"action": "rollover",
|
2018-11-05 10:17:15 -05:00
|
|
|
"action_time_millis": 1538475653317,
|
|
|
|
"action_time": "2018-10-15T13:45:22.577Z",
|
2018-10-16 15:18:54 -04:00
|
|
|
"step": "ERROR",
|
2018-11-05 10:17:15 -05:00
|
|
|
"step_time_millis": 1538475653317,
|
|
|
|
"step_time": "2018-10-15T13:45:22.577Z",
|
2019-10-31 07:28:55 -04:00
|
|
|
"failed_step": "check-rollover-ready", <1>
|
|
|
|
"is_auto_retryable_error": true, <2>
|
|
|
|
"failed_step_retry_count": 1, <3>
|
|
|
|
"step_info": { <4>
|
|
|
|
"type": "cluster_block_exception",
|
|
|
|
"reason": "index [test-000057/H7lF9n36Rzqa-KfKcnGQMg] blocked by: [FORBIDDEN/5/index read-only (api)",
|
2018-10-16 15:18:54 -04:00
|
|
|
"index_uuid": "H7lF9n36Rzqa-KfKcnGQMg",
|
|
|
|
"index": "test-000057"
|
|
|
|
},
|
|
|
|
"phase_execution": {
|
|
|
|
"policy": "my_lifecycle3",
|
|
|
|
"phase_definition": {
|
2018-10-30 15:54:02 -04:00
|
|
|
"min_age": "0ms",
|
2018-10-16 15:18:54 -04:00
|
|
|
"actions": {
|
|
|
|
"rollover": {
|
|
|
|
"max_age": "30s"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"version": 3,
|
|
|
|
"modified_date": "2018-10-15T13:21:41.576Z",
|
|
|
|
"modified_date_in_millis": 1539609701576
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// TESTRESPONSE[skip:not possible to get the cluster into this state in a docs test]
|
2019-09-09 13:38:14 -04:00
|
|
|
|
2018-11-08 18:26:27 -05:00
|
|
|
<1> The step that caused the error
|
2019-10-31 07:28:55 -04:00
|
|
|
<2> Indicates if retrying the failed step can overcome the error. If this
|
|
|
|
is true, ILM will retry the failed step automatically.
|
|
|
|
<3> Shows the number of attempted automatic retries to execute the failed
|
|
|
|
step.
|
|
|
|
<4> What went wrong
|