# ILM rollover on inconsistent docs count rather than configured configuration

**URL:** <https://discuss.elastic.co/t/ilm-rollover-on-inconsistent-docs-count-rather-than-configured-configuration/296432>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [February 7, 2022, 8:04am UTC](https://discuss.elastic.co/t/ilm-rollover-on-inconsistent-docs-count-rather-than-configured-configuration/296432 "2022-02-07T08:04:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pratikdandavate](https://avatars.discourse-cdn.com/v4/letter/p/9fc29f/32.png) [@pratikdandavate](https://discuss.elastic.co/u/pratikdandavate)\
**Post date:** [February 7, 2022, 8:04am UTC](https://discuss.elastic.co/t/ilm-rollover-on-inconsistent-docs-count-rather-than-configured-configuration/296432/1 "2022-02-07T08:04:57Z")

</div>

I have created ILM policy with following configuration :

```auto
{
    "policy": {
        "phases": {
            "hot": {
                "actions": {
                    "rollover": {
                        "max_docs": 15000
                    }
                }
            },
            "delete": {
                "min_age": "1d",
                "actions": {
                    "delete": {}
                }
            }
        }
    }
}

```

With the `index_template` for matching indices.  
Now when I bootstrap the index with initial index lets say `<index-name>-000001` then the expectation is to rollover the index once _ **docs.count** _ reaches to 15000.  
The rollover is happening but at random _docs.count_ and I'm not sure why it is happening.

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

Also when I hit refresh API, then docs count is getting updated at `/_cat/indices`. Please let me know what is wrong in the config. Did I missing anything?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 7, 2022, 8:11am UTC](https://discuss.elastic.co/t/ilm-rollover-on-inconsistent-docs-count-rather-than-configured-configuration/296432/2 "2022-02-07T08:11:03Z")

</div>

Welcome to our community! 😃  
Please don't post pictures of text, logs or code. They are difficult to read, impossible to search and replicate (if it's code), and some people may not be even able to see them 🙂

> [@pratikdandavate](#):
>
> The rollover is happening but at random _docs.count_ and I'm not sure why it is happening.

The rollover processes checks the state of the indices every 10 minutes. However there is a fair bit of discrepancy there that doesn't account for that.

What version of Elasticsearch are you on?

---

<div class="post-metadata">

**Author:** ![pratikdandavate](https://avatars.discourse-cdn.com/v4/letter/p/9fc29f/32.png) [@pratikdandavate](https://discuss.elastic.co/u/pratikdandavate)\
**Post date:** [February 7, 2022, 8:23am UTC](https://discuss.elastic.co/t/ilm-rollover-on-inconsistent-docs-count-rather-than-configured-configuration/296432/3 "2022-02-07T08:23:24Z")

</div>

Thanks for the reply, I'm using `elasticsearch-7.16.2`. The attached picture is just for reference

---

<div class="post-metadata">

**Author:** ![pratikdandavate](https://avatars.discourse-cdn.com/v4/letter/p/9fc29f/32.png) [@pratikdandavate](https://discuss.elastic.co/u/pratikdandavate)\
**Post date:** [February 14, 2022, 6:00am UTC](https://discuss.elastic.co/t/ilm-rollover-on-inconsistent-docs-count-rather-than-configured-configuration/296432/4 "2022-02-14T06:00:12Z")

</div>

One finding is when I call `/_refresh` API manually on the newly created index after predefined interval time, the rollover happening perfectly.  
Why I need to call manually the `/<index-name-000001>/_refresh` API to rollover happens ?

---

<div class="post-metadata">

**Author:** ![pratikdandavate](https://avatars.discourse-cdn.com/v4/letter/p/9fc29f/32.png) [@pratikdandavate](https://discuss.elastic.co/u/pratikdandavate)\
**Post date:** [February 15, 2022, 8:25am UTC](https://discuss.elastic.co/t/ilm-rollover-on-inconsistent-docs-count-rather-than-configured-configuration/296432/5 "2022-02-15T08:25:26Z")

</div>

The problem was with the `refresh_interval`. By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds.  
My indices were not getting search request so couldn't update the indices.  
I changed the default setting `"refresh_interval":"10s"` solved the problem.

Also I changed the `_cluster/setting` poll interval to 1 minute for testing.

---

<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:** [March 15, 2022, 8:26am UTC](https://discuss.elastic.co/t/ilm-rollover-on-inconsistent-docs-count-rather-than-configured-configuration/296432/6 "2022-03-15T08:26:03Z")

</div>

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