# Rollover by Date - What does \_refresh do and when to call it?

**URL:** <https://discuss.elastic.co/t/rollover-by-date-what-does-refresh-do-and-when-to-call-it/120909>\
**Category:** Elasticsearch\
**Created:** [February 21, 2018, 5:43pm UTC](https://discuss.elastic.co/t/rollover-by-date-what-does-refresh-do-and-when-to-call-it/120909 "2018-02-21T17:43:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![titan1978](https://avatars.discourse-cdn.com/v4/letter/t/c37758/32.png) [@titan1978](https://discuss.elastic.co/u/titan1978)\
**Post date:** [February 21, 2018, 5:43pm UTC](https://discuss.elastic.co/t/rollover-by-date-what-does-refresh-do-and-when-to-call-it/120909/1 "2018-02-21T17:43:07Z")

</div>

Am trying to understand the process of rollover using date in an Elasticsearch Index.  
Was following this link - while I understood the gist of rolloever, the link mentions TWO Steps before achieving rollover:

> Write something to the index

`POST logs_write/_refresh`

> Wait for a day to pass

`POST /logs_write/_rollover { "conditions": { "max_docs": "1" } }`

Had the following questions around this, since I didnt understand WHEN should I invoke \_refresh:

- Do I have to run BOTH these APIs each ( **\_refresh** and **\_rollover** ) end of day, in order to achieve a rollover to the next date?
- How do I automate this so the index automatically rollsover each midnight?

---

<div class="post-metadata">

**Author:** ![titan1978](https://avatars.discourse-cdn.com/v4/letter/t/c37758/32.png) [@titan1978](https://discuss.elastic.co/u/titan1978)\
**Post date:** [February 21, 2018, 11:43pm UTC](https://discuss.elastic.co/t/rollover-by-date-what-does-refresh-do-and-when-to-call-it/120909/2 "2018-02-21T23:43:54Z")

</div>

anyone? Im sure this is a pretty nuanced problem - its the first time I'm configuring the rollover, just have no clue when should these two apis be called and if I should even call **\_refresh** or should I just call **\_rollover** the next day ?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [February 22, 2018, 8:26am UTC](https://discuss.elastic.co/t/rollover-by-date-what-does-refresh-do-and-when-to-call-it/120909/3 "2018-02-22T08:26:50Z")

</div>

The `_refresh` call will flush the transaction log and make all indexed documents available for search. I am not sure why it is listed as a step in the documentation as it should generally not need to be called explicitly (refresh occurs periodically according to the refresh interval of the index). Maybe it is to ensure a refresh is performed in case you are testing these commands in quick sequence? If you look at the [blog post introducing the feature](https://www.elastic.co/blog/managing-time-based-indices-efficiently), there is no mention of the `_refresh` API.

---

<div class="post-metadata">

**Author:** ![titan1978](https://avatars.discourse-cdn.com/v4/letter/t/c37758/32.png) [@titan1978](https://discuss.elastic.co/u/titan1978)\
**Post date:** [February 22, 2018, 3:47pm UTC](https://discuss.elastic.co/t/rollover-by-date-what-does-refresh-do-and-when-to-call-it/120909/4 "2018-02-22T15:47:31Z")

</div>

I wasnt able to access th link @Christian. So I can take away that its enough that I call the API \_rollover to complete the rollover of the index?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [February 22, 2018, 3:52pm UTC](https://discuss.elastic.co/t/rollover-by-date-what-does-refresh-do-and-when-to-call-it/120909/5 "2018-02-22T15:52:40Z")

</div>

Looks like the link got mangled. Have fixed it...

---

<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 22, 2018, 3:52pm UTC](https://discuss.elastic.co/t/rollover-by-date-what-does-refresh-do-and-when-to-call-it/120909/6 "2018-03-22T15:52:48Z")

</div>

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