How to convert your existing indices to ElasticSearch ILM


To migrate existing indices to ILM the first thing you need to do is enabling ILM for new writes so that the existing indices are not written anymore.

Then, we will have to create a new exclusive policy for the existing indices:

PUT _ilm/policy/existing-indexes
{
  "policy": {
    "phases": {
      "warm": {
        "min_age": "30d",
        "actions": {
          "allocate": {
            "require": {
              "data": "warm"
            }
          },
          "forcemerge": {
            "max_num_segments": 1
          }
        }
      }
    }
  }
}

It’s very important that the new policy does not define the action rollover. The action hot is not necessary either since the indices are not gonna be rotated.

Finally, we just have to apply the new policy to the existing indices that don’t have one:

PUT existing-index-no-ilm*/_settings 
{
  "index": {
    "lifecycle.name": "existing-indexes"
  }
}

That’s all, the process will move the existing indices that match the conditions to warm mode.

Make sure that you have enough space in the warm instances to store the indices that are gonna be moved.


See also