# Elasticsearch Curator delete old-index after rollover?

**URL:** <https://discuss.elastic.co/t/elasticsearch-curator-delete-old-index-after-rollover/156836>\
**Category:** Elasticsearch\
**Created:** [November 15, 2018, 11:02am UTC](https://discuss.elastic.co/t/elasticsearch-curator-delete-old-index-after-rollover/156836 "2018-11-15T11:02:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ddregalo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ddregalo/32/32320_2.png) [@ddregalo](https://discuss.elastic.co/u/ddregalo)\
**Post date:** [November 15, 2018, 11:02am UTC](https://discuss.elastic.co/t/elasticsearch-curator-delete-old-index-after-rollover/156836/1 "2018-11-15T11:02:43Z")

</div>

I have the following curator set-up in _curator-actions.yml_ which is configured to delete indices based on age filter but I would like to set-up a config that deletes the old-index immediately after a rollover is successful so I am only ever left with the current index. Here is my current delete action...any help is much appreciated! 🙂

```auto
    action: delete_indices
    description: >-
      Delete indices older than 5 days (based on index creation date)
    options:
      ignore_empty_list: True
      continue_if_exception: True
    filters:
    - filtertype: pattern
      kind: prefix
      value: applogging-test
    - filtertype: age
      source: creation_date
      direction: older
      unit: days
      unit_count: 3

```

---

<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:** [November 15, 2018, 11:41am UTC](https://discuss.elastic.co/t/elasticsearch-curator-delete-old-index-after-rollover/156836/2 "2018-11-15T11:41:16Z")

</div>

Why would you like to remove the data so soon after rollover? That could at times leave you with an almost empty current index and no older data. How long do you need to keep the data available in the cluster?

---

<div class="post-metadata">

**Author:** ![ddregalo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ddregalo/32/32320_2.png) [@ddregalo](https://discuss.elastic.co/u/ddregalo)\
**Post date:** [November 15, 2018, 11:57am UTC](https://discuss.elastic.co/t/elasticsearch-curator-delete-old-index-after-rollover/156836/3 "2018-11-15T11:57:45Z")

</div>

> [@Christian\_Dahlqvist](#):
>
> ike to remove the data so soon after rollover

Yes, I've made a mistake in my question.

I want to keep the last N number of indices. In my case N just happens to be 2. I have read that the recommended Index size is 20GB to 40GB. I have set my rollover to occur at 30GB, so right after a rollover I will have around 30GB of data which is enough for me and why I only need to keep two indices around.

---

<div class="post-metadata">

**Author:** ![ddregalo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ddregalo/32/32320_2.png) [@ddregalo](https://discuss.elastic.co/u/ddregalo)\
**Post date:** [November 19, 2018, 2:54pm UTC](https://discuss.elastic.co/t/elasticsearch-curator-delete-old-index-after-rollover/156836/4 "2018-11-19T14:54:27Z")

</div>

SOLVED! In case someone is looking at this feed I've found a solution with the good help of @theuntergeek detailed on stackoverflow: [https://stackoverflow.com/questions/53320317/elasticsearch-curator-delete-action-delete-n-older-indices-after-rollover/53353788#53353788](http://here) .

Essentially, you can achieve this with a scheduled elastic curator - rollover and delete actions. These can be scheduled frequently as rollover and delete actions will only execute IF the conditions specified are met (if not met nothing happens and no hard done!)

---

<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:** [December 17, 2018, 2:54pm UTC](https://discuss.elastic.co/t/elasticsearch-curator-delete-old-index-after-rollover/156836/5 "2018-12-17T14:54:38Z")

</div>

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