# Deleting indices with Curator based upon age of document timestamps

**URL:** <https://discuss.elastic.co/t/deleting-indices-with-curator-based-upon-age-of-document-timestamps/246451>\
**Category:** Elasticsearch\
**Tags:** curator\
**Created:** [August 26, 2020, 12:49pm UTC](https://discuss.elastic.co/t/deleting-indices-with-curator-based-upon-age-of-document-timestamps/246451 "2020-08-26T12:49:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikewillis](https://avatars.discourse-cdn.com/v4/letter/m/b2d939/32.png) [@mikewillis](https://discuss.elastic.co/u/mikewillis)\
**Post date:** [August 26, 2020, 12:49pm UTC](https://discuss.elastic.co/t/deleting-indices-with-curator-based-upon-age-of-document-timestamps/246451/1 "2020-08-26T12:49:15Z")

</div>

All the indices I deal with contain logs from servers so I'd like to have Curator delete indices once the documents inside them refer to events that happened more than N days ago. Looking at the Curator documentation [https://www.elastic.co/guide/en/elasticsearch/client/curator/current/fe\_source.html#\_field\_stats\_based\_ages\_2](https://www.elastic.co/guide/en/elasticsearch/client/curator/current/fe_source.html#_field_stats_based_ages_2) it seems this is possible using `source: field_stats` however it's not clear to me what the example in documentation does and hence whether I want to use `min_value` or `max_value`

If I wanted an index to be deleted once all the documents in it refer to events more than 365 days ago, would this:

```auto
 - filtertype: age
   source: field_stats
   direction: older
   unit: days
   unit_count: 365
   field: '@timestamp'
   stats_result: max_value

```

be how to define that?

I'm using Curator 5.8. The cluster is currently running Elasticsearch 6.8 but will be upgraded to 7 in due course.

---

<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:** [September 23, 2020, 12:49pm UTC](https://discuss.elastic.co/t/deleting-indices-with-curator-based-upon-age-of-document-timestamps/246451/2 "2020-09-23T12:49:19Z")

</div>

Closed on September 23, 2020, 12:49pm UTC

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