# Curator and how to delete certain indices

**URL:** <https://discuss.elastic.co/t/curator-and-how-to-delete-certain-indices/134906>\
**Category:** Elasticsearch\
**Created:** [June 7, 2018, 6:58am UTC](https://discuss.elastic.co/t/curator-and-how-to-delete-certain-indices/134906 "2018-06-07T06:58:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamesl](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jamesl](https://discuss.elastic.co/u/jamesl)\
**Post date:** [June 7, 2018, 6:58am UTC](https://discuss.elastic.co/t/curator-and-how-to-delete-certain-indices/134906/1 "2018-06-07T06:58:00Z")

</div>

Hi. Right now I purge indices older than 7days. I have other indices that I need to delete sooner and others I need to keep forever. Is there an easy way to do this? an extract of my actions.yml file is below.

Thanks.

> actions:  
> 1:  
> action: delete\_indices  
> description: \>-  
> adjust indices older than x days (based on pattern), for timestring-  
> prefixed indices.  
> options:  
> ignore\_empty\_list: True  
> timeout\_override:  
> continue\_if\_exception: False  
> disable\_action: False  
> filters:  
> - filtertype: pattern  
> kind: timestring  
> value: '%Y.%m.%d'  
> exclude:  
> - filtertype: age  
> source: name  
> direction: older  
> timestring: '%Y.%m.%d'  
> unit: days  
> unit\_count: 7  
> exclude:

---

<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 7, 2018, 1:35pm UTC](https://discuss.elastic.co/t/curator-and-how-to-delete-certain-indices/134906/2 "2018-06-07T13:35:23Z")

</div>

Your paste is not properly formatted, so I can't tell what you have in your actual file. When pasting code, use the `</>` code tag in the editor, or encapsulate your text in triple back ticks like this:

````
```
PASTE HERE
```

````

With that said, it depends on what you mean by "easy."

You only need to build onto your filters until only the indices you want are included, and all other excluded. You can add multiple actions in sequence until each desired behavior is achieved.

---

<div class="post-metadata">

**Author:** ![jamesl](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jamesl](https://discuss.elastic.co/u/jamesl)\
**Post date:** [June 11, 2018, 2:11am UTC](https://discuss.elastic.co/t/curator-and-how-to-delete-certain-indices/134906/3 "2018-06-11T02:11:38Z")

</div>

Ahh yes thanks.  
I created another action-twitter.yml file and I call it with a more specific file:

```
root@els01:/etc/curator# cat /etc/curator/action-twitter.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: >-
      adjust indices older than x days (based on pattern), for timestring-
      prefixed indices.
    options:
      ignore_empty_list: True
      timeout_override:
      continue_if_exception: False
      disable_action: False
    filters:
    - filtertype: pattern
      kind: timestring
      value: 'twitter' 
      exclude:
    - filtertype: age
      source: name
      direction: older
      timestring: '%Y.%m.%d'
      unit: days
      unit_count: 5
      exclude:
root@els01:/etc/curator# 

```

I'm good now 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:** [July 9, 2018, 2:11am UTC](https://discuss.elastic.co/t/curator-and-how-to-delete-certain-indices/134906/4 "2018-07-09T02:11:38Z")

</div>

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