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
|
|
|
|
|
2018-11-08 18:26:27 -05:00
|
|
|
include::{docdir}/rest-api/timeoutparms.asciidoc[]
|
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.
|
|
|
|
For more information, see {stack-ov}/security-privileges.html[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
|
|
|
|
|
|
|
//////////////////////////
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
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
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// TEST
|
|
|
|
|
|
|
|
//////////////////////////
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
GET my_index/_ilm/explain
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// 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
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"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>
|
2018-11-08 18:26:27 -05:00
|
|
|
"phase": "new",
|
|
|
|
"phase_time_millis": 1538475653317, <4>
|
|
|
|
"action": "complete",
|
|
|
|
"action_time_millis": 1538475653317, <5>
|
|
|
|
"step": "complete",
|
|
|
|
"step_time_millis": 1538475653317 <6>
|
2018-10-16 15:18:54 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
2018-11-14 19:45:06 -05:00
|
|
|
// TESTRESPONSE[skip:no way to know if we will get this response immediately]
|
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`
|
2018-11-08 18:26:27 -05:00
|
|
|
<4> When the index entered the current phase
|
|
|
|
<5> When the index entered the current action
|
|
|
|
<6> 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
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"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",
|
|
|
|
"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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// TESTRESPONSE[skip:not possible to get the cluster into this state in a docs test]
|
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
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"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",
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// TESTRESPONSE[skip:not possible to get the cluster into this state in a docs test]
|
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
|
2018-11-08 18:26:27 -05:00
|
|
|
to the next step. To help you diagnose the problem, the explain response shows
|
|
|
|
the step that failed and the step info provides information about the error.
|
2018-10-16 15:18:54 -04:00
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"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",
|
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",
|
2018-11-16 19:42:48 -05:00
|
|
|
"failed_step": "attempt-rollover", <1>
|
2018-10-16 15:18:54 -04:00
|
|
|
"step_info": { <2>
|
|
|
|
"type": "resource_already_exists_exception",
|
|
|
|
"reason": "index [test-000057/H7lF9n36Rzqa-KfKcnGQMg] already exists",
|
|
|
|
"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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// TESTRESPONSE[skip:not possible to get the cluster into this state in a docs test]
|
2018-11-08 18:26:27 -05:00
|
|
|
<1> The step that caused the error
|
|
|
|
<2> What went wrong
|