# Elasticsearch Curator index pattern

**URL:** https://discuss.elastic.co/t/elasticsearch-curator-index-pattern/81488
**Category:** Elasticsearch
**Created:** [April 6, 2017, 2:38pm UTC](https://discuss.elastic.co/t/elasticsearch-curator-index-pattern/81488 "2017-04-06T14:38:23Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![randreucetti](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@randreucetti](https://discuss.elastic.co/u/randreucetti)
#### Post date: [April 6, 2017, 2:38pm UTC](https://discuss.elastic.co/t/elasticsearch-curator-index-pattern/81488/1 "2017-04-06T14:38:23Z")

</div>

Hi,

I'm trying to delete my old indexes with curator, however because of my index format I'm having trouble.

The format of my indices is sg-YYYY-WW but the weeks start at sg-2017-1 not sg-2017-01. This is causing my trouble with the curator age filter. Below is my config but it misses any indices with a single digit week number. Any advice on this?

```
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
filters:
- filtertype: pattern
  kind: prefix
  value: sg-
  exclude:
- filtertype: age
  source: name
  direction: older
  timestring: '%Y-%-W'
  unit: weeks
  unit_count: 4
  exclude:

```

Thanks,

Ross

---

<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: [April 6, 2017, 3:01pm UTC](https://discuss.elastic.co/t/elasticsearch-curator-index-pattern/81488/2 "2017-04-06T15:01:15Z")

</div>

Non-zero padded weeks just won't work the way you want, if you're trying to act by name. Only `%W` and `%U` handle weeks and both are zero-padded.

In very short order, Curator 5 will be released (but will only work with Elasticsearch 5.x), and it has a new `period` filter, which allows for easier index selection by week, and you'd be able to match by `creation_date` instead of name. You can still match by `creation_date` now, but only with the `age` filter, where a week is `60*60*24*7` seconds, and is completely relative to execution time. That's the best I can offer you now. In either case, you'd have to match the timestring by a regex pattern anyway, and not by name, due to the zero-padding issue.

---

<div class="post-metadata">

### Author: ![randreucetti](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@randreucetti](https://discuss.elastic.co/u/randreucetti)
#### Post date: [April 6, 2017, 3:15pm UTC](https://discuss.elastic.co/t/elasticsearch-curator-index-pattern/81488/3 "2017-04-06T15:15:16Z")

</div>

Okay,

Thanks for the quick reply.

---

<div class="post-metadata">

### Author: ![randreucetti](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@randreucetti](https://discuss.elastic.co/u/randreucetti)
#### Post date: [April 6, 2017, 3:49pm UTC](https://discuss.elastic.co/t/elasticsearch-curator-index-pattern/81488/4 "2017-04-06T15:49:24Z")

</div>

Using the creation\_date solved my problem!

Thank you

---

<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: [May 4, 2017, 3:49pm UTC](https://discuss.elastic.co/t/elasticsearch-curator-index-pattern/81488/5 "2017-05-04T15:49:34Z")

</div>

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