# Curator Delete indicies based on disk size and index age

**URL:** https://discuss.elastic.co/t/curator-delete-indicies-based-on-disk-size-and-index-age/189083
**Category:** Elasticsearch
**Tags:** curator
**Created:** [July 5, 2019, 11:27am UTC](https://discuss.elastic.co/t/curator-delete-indicies-based-on-disk-size-and-index-age/189083 "2019-07-05T11:27:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Jayabal\_K](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jayabal_k/32/41905_2.png) [@Jayabal\_K](https://discuss.elastic.co/u/Jayabal_K)
#### Post date: [July 5, 2019, 11:27am UTC](https://discuss.elastic.co/t/curator-delete-indicies-based-on-disk-size-and-index-age/189083/1 "2019-07-05T11:27:16Z")

</div>

I saw some examples to delete indicies based on size and disk\_space, can I use both the filters in one action. I want to delete the indicies which is `n days` older or it occupies `nGB` If any one of the condition meets then that index need to be deleted. Consider indicies are time based ones (test-2019.07.05.11.05-1).

Could you help me by suggesting some examples for this?

---

<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: [July 5, 2019, 5:18pm UTC](https://discuss.elastic.co/t/curator-delete-indicies-based-on-disk-size-and-index-age/189083/2 "2019-07-05T17:18:36Z")

</div>

Curator filters are `AND` based. The only real way to accomplish a logical `OR` like this is with two separate `action` blocks:

```auto
---
actions:
  1:
    action: delete_indices
    description: Delete if indices are over YOUR_VALUE_HERE days
    options:
      ignore_empty_list: true
    filters:
      - filtertype: pattern
        kind: prefix
        value: myprefix-
      - filtertype: age
        source: name
        timestring: '%Y.%m.%d.%H'
        direction: older
        unit: days
        unit_count: YOUR_VALUE_HERE
  2:
    action: delete_indices
    description: Delete if indices consume more than YOUR_VALUE_HERE gigabytes
    options:
      ignore_empty_list: true
    filters:
      - filtertype: pattern
        kind: prefix
        value: myprefix-
      - filtertype: space
        disk_space: YOUR_VALUE_HERE
        use_age: true
        source: name
        timestring: '%Y.%m.%d.%H'

```

What happens with this action file is that it first checks to see if anything is older than `YOUR_VALUE_HERE` days. If none are found, it will `ignore_empty_list` and move on without an error. It will then run action `2`, and it filters for _only_ indices matching the defined prefix (the example has `myprefix-`), and will sum the disk space consumed by each of those indices, and will delete any indices in excess of `YOUR_VALUE_HERE`, beginning with the oldest. This example, too, will exit without error even if no indices match (`ignore_empty_list`).

You can read more about the `space` filter type [here](https://www.elastic.co/guide/en/elasticsearch/client/curator/5.7/filtertype_space.html).

---

<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: [August 2, 2019, 5:18pm UTC](https://discuss.elastic.co/t/curator-delete-indicies-based-on-disk-size-and-index-age/189083/3 "2019-08-02T17:18:39Z")

</div>

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