# Flush data periodically

**URL:** <https://discuss.elastic.co/t/flush-data-periodically/51279>\
**Category:** Elasticsearch\
**Created:** [May 30, 2016, 7:10am UTC](https://discuss.elastic.co/t/flush-data-periodically/51279 "2016-05-30T07:10:23Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prateek\_Kshtriya](https://avatars.discourse-cdn.com/v4/letter/p/c37758/32.png) [@Prateek\_Kshtriya](https://discuss.elastic.co/u/Prateek_Kshtriya)\
**Post date:** [May 30, 2016, 7:10am UTC](https://discuss.elastic.co/t/flush-data-periodically/51279/1 "2016-05-30T07:10:23Z")

</div>

Hi All,

Please suggest how to configure data flush in elasticsearch periodically.

Regards,  
Prateek

---

<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:** [May 30, 2016, 7:48am UTC](https://discuss.elastic.co/t/flush-data-periodically/51279/2 "2016-05-30T07:48:50Z")

</div>

You can set the refresh interval [per index using the APIs](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html).

---

<div class="post-metadata">

**Author:** ![Prateek\_Kshtriya](https://avatars.discourse-cdn.com/v4/letter/p/c37758/32.png) [@Prateek\_Kshtriya](https://discuss.elastic.co/u/Prateek_Kshtriya)\
**Post date:** [May 30, 2016, 8:07am UTC](https://discuss.elastic.co/t/flush-data-periodically/51279/3 "2016-05-30T08:07:25Z")

</div>

Hey Christian,

Thank you for the update.  
As I understand from the link refresh interval could be defined for bulk indexing dynamically but my problem statement is -

Problem Statement- Update the current index with new data for fixed time sample(Remove the previous time data from index ).  
Example- Update the last 7 days event log to index only, remove all data earlier than the define time.

Regards,  
Prateek

---

<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:** [May 30, 2016, 8:33am UTC](https://discuss.elastic.co/t/flush-data-periodically/51279/4 "2016-05-30T08:33:34Z")

</div>

Have you considered using [time-based indices](https://www.elastic.co/guide/en/elasticsearch/guide/current/time-based.html)?

---

<div class="post-metadata">

**Author:** ![Prateek\_Kshtriya](https://avatars.discourse-cdn.com/v4/letter/p/c37758/32.png) [@Prateek\_Kshtriya](https://discuss.elastic.co/u/Prateek_Kshtriya)\
**Post date:** [May 31, 2016, 6:08am UTC](https://discuss.elastic.co/t/flush-data-periodically/51279/5 "2016-05-31T06:08:21Z")

</div>

Is it possible to schedule the steps to add and remove aliases from older index to new ,so that it remove the dependency of updating manually on a day basis.

Regards,  
Prateek

---

<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:** [May 31, 2016, 7:05am UTC](https://discuss.elastic.co/t/flush-data-periodically/51279/6 "2016-05-31T07:05:02Z")

</div>

Can you please explain your use case/problem in more detail? How are you using aliases?

---

<div class="post-metadata">

**Author:** ![Prateek\_Kshtriya](https://avatars.discourse-cdn.com/v4/letter/p/c37758/32.png) [@Prateek\_Kshtriya](https://discuss.elastic.co/u/Prateek_Kshtriya)\
**Post date:** [May 31, 2016, 7:33am UTC](https://discuss.elastic.co/t/flush-data-periodically/51279/7 "2016-05-31T07:33:15Z")

</div>

I am trying to replicate below-

POST /\_aliases  
{  
"actions": [  
{ "add": { "alias": "logs\_current", "index": "logs\_2014-10-01" }},  
{ "remove": { "alias": "logs\_current", "index": "logs\_2014-10-02" }},

]  
}  
The logs would be pushed to elasticsearch on a day basis to date based index and aliases would be changed(directed to current date index) to visualize the data on dashboard.

Regards,  
Prateek

---

<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:** [May 31, 2016, 7:40am UTC](https://discuss.elastic.co/t/flush-data-periodically/51279/8 "2016-05-31T07:40:26Z")

</div>

There is generally no need to create this type of alias when working with Kibana, as it is able to determine which indices that may contain relevant data automatically and only query those indices if you define the index pattern as `logs_*`. What is it you are looking to achieve using this alias?

---

<div class="post-metadata">

**Author:** ![Prateek\_Kshtriya](https://avatars.discourse-cdn.com/v4/letter/p/c37758/32.png) [@Prateek\_Kshtriya](https://discuss.elastic.co/u/Prateek_Kshtriya)\
**Post date:** [May 31, 2016, 11:45am UTC](https://discuss.elastic.co/t/flush-data-periodically/51279/9 "2016-05-31T11:45:35Z")

</div>

I was trying to use alias to fetch the data from different date.  
Creating index on date basis and defining index pattern as logs\_\* helped to resolve the problem statement.

Thank you for help.

Regards,  
Prateek

---

<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 5, 2017, 10:47pm UTC](https://discuss.elastic.co/t/flush-data-periodically/51279/10 "2017-07-05T22:47:42Z")

</div>


