# Index lifecycle management usages

**URL:** <https://discuss.elastic.co/t/index-lifecycle-management-usages/188256>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [July 1, 2019, 7:59am UTC](https://discuss.elastic.co/t/index-lifecycle-management-usages/188256 "2019-07-01T07:59:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vikash\_Singh1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vikash_singh1/32/42119_2.png) [@Vikash\_Singh1](https://discuss.elastic.co/u/Vikash_Singh1)\
**Post date:** [July 1, 2019, 7:59am UTC](https://discuss.elastic.co/t/index-lifecycle-management-usages/188256/1 "2019-07-01T07:59:50Z")

</div>

Hi I am using this iLm features to save the space on my system but I am bit confused with its policy. A little help would be very appreciated...  
I have decided to keep the index in below format  
HOT  
Warm - 7 Days from index creation  
Cold- 7 Days from index creation  
Delete - 7 Days from index creation  
Does it means that indices will go in Warm phase after 7 days of indices creation or after 7 days of going in warm phase it will go in cold phase..i.e. it will go in cold phase after 14 days of index creation?? Hope I am able to make sense

---

<div class="post-metadata">

**Author:** ![gbrown](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gbrown/32/34482_2.png) [@gbrown](https://discuss.elastic.co/u/gbrown)\
**Post date:** [July 5, 2019, 4:48pm UTC](https://discuss.elastic.co/t/index-lifecycle-management-usages/188256/2 "2019-07-05T16:48:05Z")

</div>

If you're referring to the `min_age` field, that age is the total age from when the index was created, or if the policy has a `rollover` action, from when the index rolled over.

For example, if I have a policy like this:

```auto
PUT _ilm/policy/sample_policy
{
  "policy": {
    "phases": {
      "hot": {
        "actions": {
          "rollover": {
            "max_age": "7d"
          }
        }
      },
      "warm": {
        "min_age": "30d",
        "actions": {
          "forcemerge": {
            "max_num_segments": 1
          }
        }
      },
      "cold": {
        "min_age": "60d",
        "actions": {
          "allocate": {
            "require": {
              "type": "cold"
            }
          }
        }
      },
      "delete": {
        "min_age": "90d",
        "actions": {
          "delete": {}
        }
      }
    }
  }
}

```

After 7 days the index will be rolled over. 30 days after that, the index will enter the `warm` phase and be force merged. 30 days after that (60 days after rollover), it will be allocated to cold nodes, and 30 days after that (90 days total after rollover), it will be deleted.

If you're not using rollover, for example with this policy:

```auto
PUT _ilm/policy/sample_policy_no_rollover
{
  "policy": {
    "phases": {
      "warm": {
        "min_age": "7d",
        "actions": {
          "shrink": {
            "number_of_shards": 1
          }
        }
      },
      "cold": {
        "min_age": "14d",
        "actions": {
          "allocate": {
            "require": {
              "type": "cold"
            }
          }
        }
      },
      "delete": {
        "min_age": "21d",
        "actions": {
          "delete": {}
        }
      }
    }
  }
}

```

This would shrink the index 7 days after the index is created, reallocate it to cold nodes 14 days after the index is created, and delete it 21 days after it is created.

You can also reference [the documentation on timing of ILM policies](https://www.elastic.co/guide/en/elasticsearch/reference/current/_timing.html) for another explanation.

Does that help?

---

<div class="post-metadata">

**Author:** ![gbrown](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gbrown/32/34482_2.png) [@gbrown](https://discuss.elastic.co/u/gbrown)\
**Post date:** [July 5, 2019, 4:50pm UTC](https://discuss.elastic.co/t/index-lifecycle-management-usages/188256/3 "2019-07-05T16:50:02Z")

</div>

Just to be extra clear, if you wrote a policy like this:

```auto
PUT _ilm/policy/sample_policy
{
  "policy": {
    "phases": {
      "warm": {
        "min_age": "7d",
        "actions": {
          "forcemerge": {
            "max_num_segments": 1
          }
        }
      },
      "cold": {
        "min_age": "7d",
        "actions": {
          "allocate": {
            "require": {
              "type": "cold"
            }
          }
        }
      },
      "delete": {
        "min_age": "7d",
        "actions": {
          "delete": {}
        }
      }
    }
  }
}

```

Where all the `min_age` fields are set to the same time, all of the actions will be performed in order 7 days after the index was created. On the 7th day, it would be force merged, then immediately reallocated to cold nodes, then deleted right after that. This is rarely what you want.

---

<div class="post-metadata">

**Author:** ![Vikash\_Singh1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vikash_singh1/32/42119_2.png) [@Vikash\_Singh1](https://discuss.elastic.co/u/Vikash_Singh1)\
**Post date:** [July 23, 2019, 9:22am UTC](https://discuss.elastic.co/t/index-lifecycle-management-usages/188256/4 "2019-07-23T09:22:17Z")

</div>

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 20, 2019, 9:22am UTC](https://discuss.elastic.co/t/index-lifecycle-management-usages/188256/5 "2019-08-20T09:22:18Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
