You've successfully subscribed to Nuvotex Blog
Great! Next, complete checkout for full access to Nuvotex Blog
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.

Triggering elasticsearch ilm step manually

Elasticsearch provides an index lifecycle management that will handle traversal of indices through a whole bunch of lifecycle steps. Sometimes you might want to give the ILM a small tap and move to a specific step manually. This guide will explain how this can be done.

Daniel Nachtrub
Daniel Nachtrub

Elasticsearch provides an index lifecycle management that will handle traversal of indices through a whole bunch of lifecycle steps. Sometimes you might want to give the ILM a small tap and move to a specific step manually. This guide will explain how this can be done.

These steps are separated into four major phases:

  • hot
  • warm
  • cold
  • delete

The phases and steps are documented here: https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-index-lifecycle.html

Depending on the age of an index a traversal through theses phases is executed and the configuration of an index is altered.

Most important use case is to adjust the resiliency for an index, possibly the storage location and set the state to reduce the amount of memory footprint associated with an index.

This article focues on the situation when the ILM doesn't advance the state of the index. In general this is not an issue of elasticearch - propably related to configuration.

Let's say we're in hot state and our index doesn't rollover or is faulted in rollover preparation. How can we trigger the index to move to warm phase?

POST _ilm/move/myindex
{
  "current_step": {
    "phase": "hot",
    "action": "rollover",
    "name": "check-rollover-ready"
  },
  "next_step": { 
    "phase": "warm",
    "action": "set_priority",
    "name": "set_priority"
  }
}
POST request to move index

This request will effectively tell elasticsearch to move from the current state check-rollover-state in hot phase to warm phase at step set_priority (which is the first available state in warm phase).

Determining state The API requires you to provide the current_step. If you don't know it, you might request with an invalid state (like shown above) and check out the response message or (more graceful) call the _ilm/explain endpoint on an index (GET myindex/_ilm/explain).

After all, the index will be moved to the desired state (i would not recommend to skip steps unless it's explicitly intended).

Database

Daniel Nachtrub

Kind of likes computers. Linux foundation certified: LFCS / CKA / CKAD / CKS. Microsoft certified: Cybersecurity Architect Expert & Azure Solutions Architect Expert.