# How to do a full update each day

**URL:** <https://discuss.elastic.co/t/how-to-do-a-full-update-each-day/184504>\
**Category:** Elasticsearch\
**Created:** [June 6, 2019, 6:58am UTC](https://discuss.elastic.co/t/how-to-do-a-full-update-each-day/184504 "2019-06-06T06:58:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hiven](https://avatars.discourse-cdn.com/v4/letter/h/ac91a4/32.png) [@Hiven](https://discuss.elastic.co/u/Hiven)\
**Post date:** [June 6, 2019, 6:58am UTC](https://discuss.elastic.co/t/how-to-do-a-full-update-each-day/184504/1 "2019-06-06T06:58:40Z")

</div>

Hello,

I use Kibana with elasticsearch. I’m new to Elasticsearch. I have a php rest api with analytic values.

Although this sounds very inefficient, my plan is to query my php rest api to get hourly data year to date, and then each hour completely clear my elasticsearch index of all existing data, and repopulate it with the year to date results of the rest api.

This way, if my elasticsearch fails to pull in the rest api data on one hour, which happens, it will be fixed on the next hour.

How do I need to approach this. Is the idea that I only have one document, with say ID 1, and then I constantly remove and repopulate that document every hour?

Is there a best practice for this sort of thing?

---

<div class="post-metadata">

**Author:** ![gabriel\_tessier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gabriel_tessier/32/27911_2.png) [@gabriel\_tessier](https://discuss.elastic.co/u/gabriel_tessier)\
**Post date:** [June 6, 2019, 8:06am UTC](https://discuss.elastic.co/t/how-to-do-a-full-update-each-day/184504/2 "2019-06-06T08:06:13Z")

</div>

Hi,

I have a similar case, I populate a datetime index each 10 minutes to have something like:

my\_index\_201906061500 then If the index have data and nothing fail I set an alias let's say my\_alias.  
Then at 15:10 I get again my fresh data and store them in my\_index\_201906061510 and if no exception and I have data in my index I switch the alias from my\_index\_201906061500 to my\_index\_201906061510 and I drop the old index.  
I always query on my\_alias, this way I always have data in worst case if something go wrong I have the data of 10 minutes ago.

If it fail you send a mail and fix 🙂.

Hope it help!

---

<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:** [July 4, 2019, 8:06am UTC](https://discuss.elastic.co/t/how-to-do-a-full-update-each-day/184504/3 "2019-07-04T08:06:16Z")

</div>

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