# Weekly ilm pattern

**URL:** <https://discuss.elastic.co/t/weekly-ilm-pattern/203199>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [October 11, 2019, 9:21am UTC](https://discuss.elastic.co/t/weekly-ilm-pattern/203199 "2019-10-11T09:21:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wedkarz014](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wedkarz014/32/48935_2.png) [@wedkarz014](https://discuss.elastic.co/u/wedkarz014)\
**Post date:** [October 11, 2019, 9:21am UTC](https://discuss.elastic.co/t/weekly-ilm-pattern/203199/1 "2019-10-11T09:21:54Z")

</div>

Hi,  
I have a problem with ILM configuration. I'd like to set up an ilm policy to create index like that: index\_name-yyyy.ww-000001. When i set it with default format- index\_name-yyyy.MM.dd-000001, it works good but with weekly indices there is something wrong because only part with numbers changes, week is steel the same as at the begging.  
basic info for you:  
Ship agent - filebeat v.6.6.2, there is nothing special settings about ilm  
logstash v.6.6.1  
elasticsearch v.6.6.1  
ilm policy:

```
    {
  "oss_kibana_policy" : {
    "version" : 3,
    "modified_date" : "2019-10-01T15:27:26.105Z",
    "policy" : {
      "phases" : {
        "hot" : {
          "min_age" : "0ms",
          "actions" : {
            "rollover" : {
              "max_size" : "50gb",
              "max_age" : "7d"
            }
          }
        },
        "delete" : {
          "min_age" : "14d",
          "actions" : {
            "delete" : { }
          }
        },
        "warm" : {
          "min_age" : "0ms",
          "actions" : {
            "shrink" : {
              "number_of_shards" : 1
            }
          }
        }
      }
    }
  }
}

```

template  
`{
"oss_kibana" : {
"order" : 0,
"index_patterns" : [
"oss_kibana*"
],
"settings" : {
"index" : {
"lifecycle" : {
"name" : "oss_kibana_policy",
"rollover_alias" : "oss_kibana"
},
"number_of_shards" : "3",
"number_of_replicas" : "1"
}
},
"mappings" : { },
"aliases" : { }
}
}`

i created first index with is write alias  
PUT oss\_kibana-2019.40-000001  
` {
"aliases": {
"oss_kibana":{
"is_write_index": true
}
}
}`

and here is my weekly logstash output:  
`elasticsearch {
# index => "oss_kibana-%{+yyyy.ww}"
ilm_pattern => "{now/w{yyyy.ww}}-000001"
index => "oss_kibana"
hosts => [
"elasticsearch:9200"
]
ssl => true
user => logstash
password => password
cacert => "/usr/share/logstash/config/root-ca.pem"
}`

ilm\_pattern =\> "{now/w}-000001" didn't work too

Would you be so kind and help with that issue?

---

<div class="post-metadata">

**Author:** ![dakrone](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dakrone/32/23351_2.png) [@dakrone](https://discuss.elastic.co/u/dakrone)\
**Post date:** [October 14, 2019, 8:39pm UTC](https://discuss.elastic.co/t/weekly-ilm-pattern/203199/2 "2019-10-14T20:39:10Z")

</div>

The index date math "inherits" the math from the _first_ index created, so in your case it's created as `oss_kibana-2019.40-000001`, but it really needs to be created as `<oss_kibana{now/w{yyyy.ww}}-000001>`:

```auto
PUT %3Coss_kibana%7Bnow%2Fw%7Byyyy.ww%7D%7D-000001%3E
{
  "aliases": {
    "oss_kibana":{
      "is_write_index": true
    }
  }
}

```

You can confirm this by checking the "`provided_name`" setting in the index settings, it should have the `<...{...}>` parts in it.

---

<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:** [November 11, 2019, 8:39pm UTC](https://discuss.elastic.co/t/weekly-ilm-pattern/203199/3 "2019-11-11T20:39:12Z")

</div>

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