Checking progress

edit

Now that we have an index managed by our policy, how do we tell what is going on? Which phase are we in? Is something broken? This section will go over a few APIs and their responses to help us inspect our indices with respect to ILM.

With the help of the Explain API, we can know things like which phase we’re in and when we entered that phase. The API will also provide further info if errors occurred, or if we are blocked on certain checks within actions.

GET datastream-*/_ilm/explain

The above request will retrieve ILM execution information for all our managed indices.

{
  "indices": {
    "datastream-000001": {
      "index": "datastream-000001",
      "managed": true,                           
      "policy": "datastream_policy",             
      "lifecycle_date_millis": 1538475653281,
      "phase": "hot",                            
      "phase_time_millis": 1538475653317,
      "action": "rollover",                      
      "action_time_millis": 1538475653317,
      "step": "attempt-rollover",                
      "step_time_millis": 1538475653317,
      "phase_execution": {
        "policy": "datastream_policy",
        "phase_definition": {                    
          "min_age": "0ms",
          "actions": {
            "rollover": {
              "max_size": "50gb",
              "max_age": "30d"
            }
          }
        },
        "version": 1,                            
        "modified_date_in_millis": 1539609701576
      }
    }
  }
}

this index is managed by ILM

the policy in question, in this case, "datastream_policy"

what phase the index is currently in

what action the index is currently on

what step the index is currently on

the definition of the phase (in this case, the "hot" phase) that the index is currently on

the version of the policy being used to execute the current phase

You can read about the full details of this response in the explain API docs. For now, let’s focus on how the response details which phase, action, and step we’re in. We are in the "hot" phase, and "rollover" action. Rollover will continue to be called by ILM until its conditions are met and it rolls over the index. Afterwards, the original index will stay in the hot phase until 90 more days pass and it is deleted in the delete phase. As time goes on, new indices will be created and deleted. With datastream-000002 being created when the index mets the rollover conditions and datastream-000003 created after that. We will be able to search across all of our managed indices using the "datastream" alias, and we will be able to write to our to-be-rolled-over write indices using that same alias.

That’s it! We have our first use-case managed by ILM.

To learn more about all our APIs, check out ILM APIs.