liveBook · Manning

Index lifecycle phase

As explained in Elasticsearch in Action, Second Edition

An index lifecycle phase is a stage in an index lifecycle during which specified actions may be executed according to defined conditions.

A production index can change roles over time: it may accept searches and writes while hot, become read-only when warm or cold, and eventually be deleted. Each index lifecycle phase is a stage where configured actions run when their conditions are satisfied. section 6.10 section 6.9

An ILM policy defines the phases and their actions. A phase can wait for a minimum age before acting, while the next phase begins after its configured actions complete. Policies can use conditions such as index size, document count, or elapsed time. section 6.9.2 section 6.9

Listing 6.48 Creating a policy with hot and delete phases
PUT _ilm/policy/hot_delete_policy    #1
{
  "policy": {                        #2
    "phases": {
      "hot": {                       #3
        "min_age": "1d",             #4
        "actions": {                 #5
          "set_priority": {          #6
            "priority": 250
          }
        }
      }, 
      "delete": {                    #7
        "actions": {
          "delete" : { }
        }
      }
    }
  }
}

This policy keeps an index in the hot phase for one day, sets its recovery priority, and then deletes it immediately after the hot phase finishes. section 6.9.2

Attach a lifecycle to an index

Create the index with index.lifecycle.name pointing to hot_delete_policy. The association causes the index to enter the hot phase and follow the policy’s phase transitions. section 6.9.2

How Elasticsearch in Action, Second Edition covers it

How deep it goes
Explains phase conditions, minimum age, actions, and transitions, but does not detail every available phase action.
Examples
Uses a hot phase that waits one day and sets priority before a delete phase removes the index.
What it assumes
Assumes familiarity with creating indexes and introduces policy definition, phase actions, and lifecycle association.
What you can do after
Operate/configure index transitions by defining phases in an ILM policy and associating that policy with an index.
How it connects
Connects index lifecycle management with lifecycle policies, rollover, index creation, and read-only indexes.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Elasticsearch in Action, Second Edition. The section links point to the parts of the book it draws on.