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

(Praetor) #1

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?

(Praetor) #2

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 ?

(Christian Dahlqvist) #3

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, there is no mention of the _refresh API.

(Praetor) #4

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?

(Christian Dahlqvist) #5

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

(system) #6

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