# How to name dated Index for ILM with Roll over

**URL:** <https://discuss.elastic.co/t/how-to-name-dated-index-for-ilm-with-roll-over/244880>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [August 13, 2020, 12:38pm UTC](https://discuss.elastic.co/t/how-to-name-dated-index-for-ilm-with-roll-over/244880 "2020-08-13T12:38:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rahulkothanath](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahulkothanath/32/99122_2.png) [@rahulkothanath](https://discuss.elastic.co/u/rahulkothanath)\
**Post date:** [August 13, 2020, 12:38pm UTC](https://discuss.elastic.co/t/how-to-name-dated-index-for-ilm-with-roll-over/244880/1 "2020-08-13T12:38:38Z")

</div>

I have an ILM policy with roll over functionality and below is my Index name which consists of year-month-date and roll over series.(YYYY.MM.DD-000001)

```
    'PUT test-2020.07.26-000001
    {
      "aliases": {
        "test_alias": {
          "is_write_index": true
        }
      }
    }'

```

I have bootstrapped the ILM with write alias and currently data is pushing into index(test-2020.07.26-000001)

below are my doubts:

1. if roll over condition is met on July 31st, will my index roll over to "test-2020.07.31-000002" or "test-2020.07.26-000002"

2. will the data of 8th month will be inserted into "test-2020.08.01-000001" Index ?

3. is my index naming convention correct? if not how can I reflect year,month,date changes in new rolled indexes?

Thanks for the help.

---

<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:** [August 13, 2020, 6:49pm UTC](https://discuss.elastic.co/t/how-to-name-dated-index-for-ilm-with-roll-over/244880/2 "2020-08-13T18:49:15Z")

</div>

You need to use the date math and escape it correctly, so for instance:

```auto
PUT /%3Ctest-%7Bnow%2Fd%7D-000001%3E
{
  "aliases": {
    "test_alias": {
      "is_write_index": true
    }
  }
}

```

Which is essentially sending `<test-{now/d}-000001>` as the index name

> - if roll over condition is met on July 31st, will my index roll over to "test-2020.07.31-000002" or "test-2020.07.26-000002"

The index would be "test-2020.07.31-000002" (once set up properly)

> - will the data of 8th month will be inserted into "test-2020.08.01-000001" Index ?

It won't be -000001, as the number of the index at the end always increases when the index is rolled over.

---

<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:** [September 10, 2020, 6:49pm UTC](https://discuss.elastic.co/t/how-to-name-dated-index-for-ilm-with-roll-over/244880/3 "2020-09-10T18:49:20Z")

</div>

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