# Can Elasticsearch be configured to remove old data regularly?

**URL:** <https://discuss.elastic.co/t/can-elasticsearch-be-configured-to-remove-old-data-regularly/70502>\
**Category:** Elasticsearch\
**Created:** [January 4, 2017, 2:01am UTC](https://discuss.elastic.co/t/can-elasticsearch-be-configured-to-remove-old-data-regularly/70502 "2017-01-04T02:01:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qian\_Zhang](https://avatars.discourse-cdn.com/v4/letter/q/779978/32.png) [@Qian\_Zhang](https://discuss.elastic.co/u/Qian_Zhang)\
**Post date:** [January 4, 2017, 2:01am UTC](https://discuss.elastic.co/t/can-elasticsearch-be-configured-to-remove-old-data-regularly/70502/1 "2017-01-04T02:01:05Z")

</div>

Hi,

I am using Elasticsearch 2.4.1, and have Logstash 2.4.1 and Heapster 1.2.0 to send logs and performance metrics to Elasticsearch, my index are like this:

> $ curl 127.0.0.1:9200/\_cat/indices?v  
> health status index pri rep docs.count docs.deleted store.size pri.store.size  
> green open logstash-2017.01.03 1 0 622530 0 399.6mb 399.6mb  
> green open logstash-2017.01.04 1 0 64176 0 40.2mb 40.2mb  
> green open heapster 1 0 408956 0 62.2mb 62.2mb

Logstash and Heapster will send a lot of data to Elasticsearch every day. So I am wondering if Elasticsearch can be configured to remove oldest data regularly, e.g., only keep the data of the last 1 day or 1 week.

Thanks,  
Qian

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [January 4, 2017, 2:14am UTC](https://discuss.elastic.co/t/can-elasticsearch-be-configured-to-remove-old-data-regularly/70502/2 "2017-01-04T02:14:23Z")

</div>

The usual way to do this is to cron [curator](https://www.elastic.co/guide/en/elasticsearch/client/curator/current/about.html) to run at some time that is convenient to you.

---

<div class="post-metadata">

**Author:** ![Qian\_Zhang](https://avatars.discourse-cdn.com/v4/letter/q/779978/32.png) [@Qian\_Zhang](https://discuss.elastic.co/u/Qian_Zhang)\
**Post date:** [January 4, 2017, 2:22am UTC](https://discuss.elastic.co/t/can-elasticsearch-be-configured-to-remove-old-data-regularly/70502/3 "2017-01-04T02:22:28Z")

</div>

Thanks Nik!

It seems Curator has it own release versions, like: 4.0, 4.1, 4.2. Can you please let me know which one is best for Elasticsearch 2.4.1?

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [January 4, 2017, 3:03am UTC](https://discuss.elastic.co/t/can-elasticsearch-be-configured-to-remove-old-data-regularly/70502/4 "2017-01-04T03:03:19Z")

</div>

Curator v4 works with any Elasticsearch version 2.x or 5.0 & 5.1

See the compatibility matrix at [https://github.com/elastic/curator](https://github.com/elastic/curator)

---

<div class="post-metadata">

**Author:** ![Qian\_Zhang](https://avatars.discourse-cdn.com/v4/letter/q/779978/32.png) [@Qian\_Zhang](https://discuss.elastic.co/u/Qian_Zhang)\
**Post date:** [January 4, 2017, 3:04am UTC](https://discuss.elastic.co/t/can-elasticsearch-be-configured-to-remove-old-data-regularly/70502/5 "2017-01-04T03:04:25Z")

</div>

Got it, thanks!

---

<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:** [February 1, 2017, 3:04am UTC](https://discuss.elastic.co/t/can-elasticsearch-be-configured-to-remove-old-data-regularly/70502/6 "2017-02-01T03:04:30Z")

</div>

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