# Index delete using curator 5.1

**URL:** <https://discuss.elastic.co/t/index-delete-using-curator-5-1/90454>\
**Category:** Elasticsearch\
**Created:** [June 22, 2017, 1:07pm UTC](https://discuss.elastic.co/t/index-delete-using-curator-5-1/90454 "2017-06-22T13:07:09Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)\
**Post date:** [June 22, 2017, 1:07pm UTC](https://discuss.elastic.co/t/index-delete-using-curator-5-1/90454/1 "2017-06-22T13:07:09Z")

</div>

Hi ,  
I'm using curator to delete my index by time basic, but in my index name doesn't contain timestring.

How could i perform this delete operation.

ACTION.YMl

```
---
# Remember, leave a key empty if there is no value. None will be a string,
# not a Python "NoneType"
#
# Also remember that all examples have 'disable_action' set to True. If you
# want to use this action as a template, be sure to set this to False after
# copying it.
actions:
  1:
    action: delete_indices
    description: delete
    options:
      ignore_empty_list: True
      disable_action: false
      continue_if_exception : True
    filters:
    #- filtertype:kibana
    # exclude:False   
    - filtertype: age
      source: field_stats
      field: 'log_timestamp'        
      direction: older
      unit: days
      unit_count: 90  

```

Index name be like this "logstash-dd.log"

---

<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:13pm UTC](https://discuss.elastic.co/t/index-delete-using-curator-5-1/90454/2 "2017-06-22T19:13:51Z")

</div>

Does this action file not work? It seems properly configured. Try running with `--dry-run` to see the list that would be deleted on an actual run.

---

<div class="post-metadata">

**Author:** ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)\
**Post date:** [June 23, 2017, 6:02am UTC](https://discuss.elastic.co/t/index-delete-using-curator-5-1/90454/3 "2017-06-23T06:02:15Z")

</div>

When i run the above file i'm getting following error. Its searching different index and throwing error.

```
2017-06-22 23:00:59,742 INFO Preparing Action ID: 1, "delete_indices"
2017-06-22 23:00:59,750 INFO Trying Action ID: 1, "delete_indices": delete
2017-06-22 23:00:59,769 ERROR Failed to complete action: delete_indices. <class 'curator.exceptions.ActionError'>: Field "zephyr_timestamp" not found in index "logstash-dd.dcs_owner_log"

```

Please help me to be specific exact index name to perform delete option.

---

<div class="post-metadata">

**Author:** ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)\
**Post date:** [June 23, 2017, 11:33am UTC](https://discuss.elastic.co/t/index-delete-using-curator-5-1/90454/4 "2017-06-23T11:33:48Z")

</div>

i have indexed value for 3 months like jan,feb,mar. I want to delete the entire feb month index value from index. How could i perform that using curator.

Index name like "logstash-dd.name\_log"

---

<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 23, 2017, 5:24pm UTC](https://discuss.elastic.co/t/index-delete-using-curator-5-1/90454/5 "2017-06-23T17:24:50Z")

</div>

Okay, I'm a bit confused. The configuration you shared has:

```auto
      source: field_stats
      field: 'log_timestamp' 

```

But the error message indicates a field called `zephyr_timestamp`. The bottom line is that when using `source: field_stats`, whatever you select for `field` _must_ be in _all_ of the indices being acted on. If that field is not found in even one of the indices to be acted on, an exception like the one you shared will happen.

> [@Ganesh2303](#):
>
> i have indexed value for 3 months like jan,feb,mar. I want to delete the entire feb month index value from index.
> 
> Index name like "logstash-dd.name\_log"

If the values for all three months are all in one index, then you cannot use Curator to delete them. Curator does not delete selective data from indices. It can only delete entire indices.

---

<div class="post-metadata">

**Author:** ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)\
**Post date:** [June 27, 2017, 9:33am UTC](https://discuss.elastic.co/t/index-delete-using-curator-5-1/90454/6 "2017-06-27T09:33:57Z")

</div>

I got your point, having one more doubt please clarify it.

I want to delete old record for example need to keep last 90 days of records in my index. How could i perform that?

I tried using age filtertype but it delete entire index. help me on this

Index name will not contain timestamp value.

```
- filtertype: age
  source: field_stats
  field: '@timestamp'     
  stats_result: min_value 
  direction: older
  unit: days
  unit_count: 90
```

---

<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 27, 2017, 1:42pm UTC](https://discuss.elastic.co/t/index-delete-using-curator-5-1/90454/7 "2017-06-27T13:42:15Z")

</div>

> [@Ganesh2303](#):
>
> I want to delete old record for example need to keep last 90 days of records in my index. How could i perform that?
> 
> I tried using age filtertype but it delete entire index. help me on this

Curator only does index-level management. You can only use it to delete entire indices.

Elasticsearch offers a delete-by-query plugin. You should ask a separate question for that.

---

<div class="post-metadata">

**Author:** ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)\
**Post date:** [June 27, 2017, 1:43pm UTC](https://discuss.elastic.co/t/index-delete-using-curator-5-1/90454/8 "2017-06-27T13:43:20Z")

</div>

Thanks for your reply

---

<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 25, 2017, 1:43pm UTC](https://discuss.elastic.co/t/index-delete-using-curator-5-1/90454/9 "2017-07-25T13:43:28Z")

</div>

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