# ILM policy is not followed correctly and index is not getting rollover as per doc size or max age

**URL:** https://discuss.elastic.co/t/ilm-policy-is-not-followed-correctly-and-index-is-not-getting-rollover-as-per-doc-size-or-max-age/312306
**Category:** Kibana
**Tags:** ilm-index-lifecycle-management
**Created:** [August 17, 2022, 4:06pm UTC](https://discuss.elastic.co/t/ilm-policy-is-not-followed-correctly-and-index-is-not-getting-rollover-as-per-doc-size-or-max-age/312306 "2022-08-17T16:06:07Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![PRASHANT\_MEHTA](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prashant_mehta/32/101764_2.png) [@PRASHANT\_MEHTA](https://discuss.elastic.co/u/PRASHANT_MEHTA)
#### Post date: [August 17, 2022, 4:06pm UTC](https://discuss.elastic.co/t/ilm-policy-is-not-followed-correctly-and-index-is-not-getting-rollover-as-per-doc-size-or-max-age/312306/1 "2022-08-17T16:06:07Z")

</div>

Hello All,

I'm facing major challenges with regards to ILM policy for all my indexes.

In ILM policy I'm using two phase HOT and DELETE.  
Hot Phase- It should have max 2mb of data or data should be there for 3 min then rollover.  
Issue faced- The data keep on writing on same index, i.e became 5mb and after some time it got rollover i.e it didn't even follow 3min defined in policy.

Why dosent policy is followed strictly like if more than 2MB or more than 3 min either it should have rolled over.But it takes some random time to get rolled over in HOT face.

Delete phase- Defined to delete data after 2 seconds from rollover,even though now index was rollover as per above condition but didnt got deleted after 2 seconds.

What if the data become to large then this delay will also increase?,this is a major issue.

Ideally my data can be from 1GB to 30 Gb or 500Mb as well and want to delete this data after 1 month and new data should be rolled over to new index.But above is the challenge faced.

Any suggestion would be helpful.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/5/d5b5bcd4cb7fa4a878e0232793450e356fb1ee7c.png)

```auto
PUT _ilm/policy/cis-metric-policy
{
  "policy": {
    "phases": {
      "hot": {
        "min_age": "0ms",
        "actions": {
          "rollover": {
            "max_age": "3m",
            "max_size": "2mb"
          },
          "set_priority": {
            "priority": null
          }
        }
      },
      "delete": {
        "min_age": "2s",
        "actions": {
          "delete": {
            "delete_searchable_snapshot": true
          }
        }
      }
    }
  }
}

```

Thanx

---

<div class="post-metadata">

### Author: ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)
#### Post date: [August 17, 2022, 6:01pm UTC](https://discuss.elastic.co/t/ilm-policy-is-not-followed-correctly-and-index-is-not-getting-rollover-as-per-doc-size-or-max-age/312306/2 "2022-08-17T18:01:06Z")

</div>

don't know why it is happening  
may be too short max\_age?

try putting like 30m and max\_size like 1gig. see if it rolls over.  
I have 50gig and 2 days and it does rollover around 49.x or 50.x gig everyday.

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [August 18, 2022, 3:08am UTC](https://discuss.elastic.co/t/ilm-policy-is-not-followed-correctly-and-index-is-not-getting-rollover-as-per-doc-size-or-max-age/312306/3 "2022-08-18T03:08:01Z")

</div>

Hi @PRASHANT_MEHTA Those sizes and timeframes are too short..

ILM is not really design to operate on "Minute" Scheduled or Small KB/MB indices is designed to manage large scale indices GB, Hours, Days etc. and for that it works very well.

I posted a bit about it [here](https://discuss.elastic.co/t/rollover-goes-beyond-the-condition/207442/2) and another elastician [here](https://discuss.elastic.co/t/lifecycle-policies-dont-work/276218/13)

---

<div class="post-metadata">

### Author: ![Mangesh\_Mathe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mangesh_mathe/32/103371_2.png) [@Mangesh\_Mathe](https://discuss.elastic.co/u/Mangesh_Mathe)
#### Post date: [August 22, 2022, 11:46am UTC](https://discuss.elastic.co/t/ilm-policy-is-not-followed-correctly-and-index-is-not-getting-rollover-as-per-doc-size-or-max-age/312306/4 "2022-08-22T11:46:43Z")

</div>

Hello @stephenb  
Can you please tell me , what if I want to rollover my indices on monthly basis.  
I want to generate rollover indices for SEPT...OCT...NOV...DEC  
I know we can use **"max\_age":"30d"** for that , but it will create problem for the months having 31 days & 28 days in a year.

```auto
 "actions": {
          "rollover": {
            "max_age": "(Monthly)",

```

---

<div class="post-metadata">

### Author: ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)
#### Post date: [August 22, 2022, 1:04pm UTC](https://discuss.elastic.co/t/ilm-policy-is-not-followed-correctly-and-index-is-not-getting-rollover-as-per-doc-size-or-max-age/312306/5 "2022-08-22T13:04:48Z")

</div>

what is the reason for having this?  
are you thinking you can drop them at your convivence?

if you want index by Month you will have to define index name in logstash something like  
index\_name-MM

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [August 22, 2022, 3:38pm UTC](https://discuss.elastic.co/t/ilm-policy-is-not-followed-correctly-and-index-is-not-getting-rollover-as-per-doc-size-or-max-age/312306/6 "2022-08-22T15:38:02Z")

</div>

> [@Mangesh\_Mathe](#):
>
> Can you please tell me , what if I want to rollover my indices on monthly basis.  
> I want to generate rollover indices for SEPT...OCT...NOV...DEC  
> I know we can use **"max\_age":"30d"** for that , but it will create problem for the months having 31 days & 28 days in a year.

"Calendar Units" are not currently supported as far as I know with ILM Hours, Days, GB etc. I do not think they are on the road map.

Most users think of ILM Policies in Days... 7 days Hot 23 Days Warm 30 Days Cold etc... regardless of the Calendar month.

---

<div class="post-metadata">

### Author: ![Mangesh\_Mathe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mangesh_mathe/32/103371_2.png) [@Mangesh\_Mathe](https://discuss.elastic.co/u/Mangesh_Mathe)
#### Post date: [August 23, 2022, 5:18am UTC](https://discuss.elastic.co/t/ilm-policy-is-not-followed-correctly-and-index-is-not-getting-rollover-as-per-doc-size-or-max-age/312306/7 "2022-08-23T05:18:42Z")

</div>

Yah, Even I also thought the same.  
But wanted to confirm. Thank you so much !

---

<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: [September 20, 2022, 5:19am UTC](https://discuss.elastic.co/t/ilm-policy-is-not-followed-correctly-and-index-is-not-getting-rollover-as-per-doc-size-or-max-age/312306/8 "2022-09-20T05:19:31Z")

</div>

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