# Curator for deleting indices older than 30 days or more based on a field that isn't of type date

**URL:** https://discuss.elastic.co/t/curator-for-deleting-indices-older-than-30-days-or-more-based-on-a-field-that-isnt-of-type-date/89248
**Category:** Elasticsearch
**Created:** [June 13, 2017, 5:19pm UTC](https://discuss.elastic.co/t/curator-for-deleting-indices-older-than-30-days-or-more-based-on-a-field-that-isnt-of-type-date/89248 "2017-06-13T17:19:16Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![shrenikgala](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@shrenikgala](https://discuss.elastic.co/u/shrenikgala)
#### Post date: [June 13, 2017, 5:19pm UTC](https://discuss.elastic.co/t/curator-for-deleting-indices-older-than-30-days-or-more-based-on-a-field-that-isnt-of-type-date/89248/1 "2017-06-13T17:19:16Z")

</div>

{  
"\_index": "user:1494813192000",  
"\_type": "fruits",  
"\_id": "pbyac5r88-yghe-v1ez-cpgb-sqdjipr54alzgj/tp4oqalbd-bo2v-ikj1-atfq-wezcoeeuf6wiqpt/apple",  
"\_score": 1,  
"\_routing": "pbyac5r88-yghe-v1ez-cpgb-sqdjipr54alzgj",  
"\_source": {  
"numCal": 442,  
"eventTime": 1497315192000,  
"fruitName": "apple"  
}

This is how the index in my elasticsearch looks like. The eventTime is the current time in ms based on UTC. I would want to use that field to delete my indices using the curator.

This is how my ACTION\_FILE.YML looks like  
actions:  
1:  
action: delete\_indices  
description: \>-  
Delete indices older than 45 days (based on index name), for logstash-  
prefixed indices. Ignore the error if the filter does not result in an  
actionable list of indices (ignore\_empty\_list) and exit cleanly.  
options:  
ignore\_empty\_list: True  
timeout\_override:  
continue\_if\_exception: False  
disable\_action: False  
filters:  
- filtertype: age  
source: field\_stats  
field: 'eventTime'  
direction: older  
unit: days  
unit\_count: 30  
exclude:

Does curator support deleting based on fields that aren't in data format?

---

<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: [June 13, 2017, 8:14pm UTC](https://discuss.elastic.co/t/curator-for-deleting-indices-older-than-30-days-or-more-based-on-a-field-that-isnt-of-type-date/89248/2 "2017-06-13T20:14:33Z")

</div>

> [@shrenikgala](#):
>
> how do I make this a recurring job that the curator would do.

In Linux/Unix systems, you use cron. In Windows, use the Task Scheduler.

---

<div class="post-metadata">

### Author: ![shrenikgala](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@shrenikgala](https://discuss.elastic.co/u/shrenikgala)
#### Post date: [June 19, 2017, 7:04pm UTC](https://discuss.elastic.co/t/curator-for-deleting-indices-older-than-30-days-or-more-based-on-a-field-that-isnt-of-type-date/89248/3 "2017-06-19T19:04:50Z")

</div>

Thanks. I realized that I was missing the index prefix too, it worked after I put that inside the yml file. Also how do I make this a recurring job that the curator would do.

---

<div class="post-metadata">

### Author: ![shrenikgala](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@shrenikgala](https://discuss.elastic.co/u/shrenikgala)
#### Post date: [June 22, 2017, 7:50pm UTC](https://discuss.elastic.co/t/curator-for-deleting-indices-older-than-30-days-or-more-based-on-a-field-that-isnt-of-type-date/89248/4 "2017-06-22T19:50:39Z")

</div>

There isn't a parameter that could be set in the ACTION file to make it recur ?

---

<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: [June 22, 2017, 7:57pm UTC](https://discuss.elastic.co/t/curator-for-deleting-indices-older-than-30-days-or-more-based-on-a-field-that-isnt-of-type-date/89248/5 "2017-06-22T19:57:25Z")

</div>

No. It's not presently designed to be daemonized.

---

<div class="post-metadata">

### Author: ![shrenikgala](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@shrenikgala](https://discuss.elastic.co/u/shrenikgala)
#### Post date: [June 22, 2017, 7:58pm UTC](https://discuss.elastic.co/t/curator-for-deleting-indices-older-than-30-days-or-more-based-on-a-field-that-isnt-of-type-date/89248/6 "2017-06-22T19:58:54Z")

</div>

Thanks for the quick reply. Btw how would you suggest doing this, having a cron job or having a docker with curator running on the elasticsearch machine.

---

<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: [June 22, 2017, 9:40pm UTC](https://discuss.elastic.co/t/curator-for-deleting-indices-older-than-30-days-or-more-based-on-a-field-that-isnt-of-type-date/89248/7 "2017-06-22T21:40:29Z")

</div>

Either is completely acceptable. cron may be slightly more common, but I see a lot of both cron and Docker

---

<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 20, 2017, 9:40pm UTC](https://discuss.elastic.co/t/curator-for-deleting-indices-older-than-30-days-or-more-based-on-a-field-that-isnt-of-type-date/89248/8 "2017-07-20T21:40:45Z")

</div>

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