# Filters not working when used in actions yaml file, but it works when using the command line filters options

**URL:** <https://discuss.elastic.co/t/filters-not-working-when-used-in-actions-yaml-file-but-it-works-when-using-the-command-line-filters-options/293692>\
**Category:** Kibana\
**Tags:** curator\
**Created:** [January 6, 2022, 9:43pm UTC](https://discuss.elastic.co/t/filters-not-working-when-used-in-actions-yaml-file-but-it-works-when-using-the-command-line-filters-options/293692 "2022-01-06T21:43:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pedroplopez](https://avatars.discourse-cdn.com/v4/letter/p/f0a364/32.png) [@pedroplopez](https://discuss.elastic.co/u/pedroplopez)\
**Post date:** [January 6, 2022, 9:43pm UTC](https://discuss.elastic.co/t/filters-not-working-when-used-in-actions-yaml-file-but-it-works-when-using-the-command-line-filters-options/293692/1 "2022-01-06T21:43:32Z")

</div>

Elasticsearch:  
Kibana Version: 7.15  
Curator Version: 5.8.4

Hi, I'm working on creating an `action` file I can use with `curator` to delete Kibana indices older than 30 days from creation date. I wrote the following `action` file, however, when I tried using it, it didn't quite worked, it would only find 1 or 2 files for deletion:

```auto
actions:
  1:
    action: delete_indices
    description: >-
      Delete indices older than 30 days
    options:
      ignore_empty_list: True
      continue_if_exception: False
      disable_action: False
    filters:
    - filtertype: pattern
      kind: regex
      value: '^(auditbeat-|apm-|filebeat-|metricbeat-|test-filebeat-)*'
    - filtertype: age
      source: creation_date
      direction: older
      unit: days
      unit_count: 30

```

After researching on the web I decided to try using the command line `filters_list` options, and this time it work as expected. Here is I had to do from the command line:

```auto
curator-home-here.../curator_cli $mode --config curator/config_file.yml delete-indices --filter_list '[{"filtertype":"pattern","kind":"prefix","value":"filebeat-"}, {"filtertype":"age","source":"creation_date","direction":"older","unit":"days","unit_count":30}]'

```

Before switching to using the command line, I played with the `filtertype:pattern` quite a bit because I thought that's what the problem stemmed from, but it didn't matter what I did, I could not make the `action` file did work as I was hoping.

I was wondering if anybody had come across this issue before, and knows a way to use the `action` file effectively.

---

<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:** [February 3, 2022, 9:44pm UTC](https://discuss.elastic.co/t/filters-not-working-when-used-in-actions-yaml-file-but-it-works-when-using-the-command-line-filters-options/293692/2 "2022-02-03T21:44:23Z")

</div>

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