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?
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 ?
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.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.