# Can i create aliases with month and year in index templates?

**URL:** <https://discuss.elastic.co/t/can-i-create-aliases-with-month-and-year-in-index-templates/81089>\
**Category:** Elasticsearch\
**Created:** [April 4, 2017, 7:18am UTC](https://discuss.elastic.co/t/can-i-create-aliases-with-month-and-year-in-index-templates/81089 "2017-04-04T07:18:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yaswanth](https://avatars.discourse-cdn.com/v4/letter/y/94ad74/32.png) [@Yaswanth](https://discuss.elastic.co/u/Yaswanth)\
**Post date:** [April 4, 2017, 7:18am UTC](https://discuss.elastic.co/t/can-i-create-aliases-with-month-and-year-in-index-templates/81089/1 "2017-04-04T07:18:33Z")

</div>

Hi,

i have to create alias with indexname,month and year.

```
{
  "template": data-*",
  "settings": {
    "number_of_shards": 1
  },
  "aliases": {
    "my_index-%{year}-%{month}": {}
  }
}

```

When the i tried above template it is creating alias with exact string i specified(i.e.my\_index-%{year}-%{month}) rather than printing year and month (i.e data-2017-03) .

FYI - My index is in the format `data-2017-03-25` .

IS it possible to create dynamic alias in index templates?

Thanks

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [April 4, 2017, 8:02am UTC](https://discuss.elastic.co/t/can-i-create-aliases-with-month-and-year-in-index-templates/81089/2 "2017-04-04T08:02:10Z")

</div>

My original answer here hasn't changed. Also, please don't post the same thing multiple times.

> [@Is it possible to create aliases on a monthly basis using index templates?](https://discuss.elastic.co/t/is-it-possible-to-create-aliases-on-a-monthly-basis-using-index-templates/80850/4):
>
> ES handles more static aliases, like last-month, it can't do date math in templates. Have you tried curator?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [April 4, 2017, 8:02am UTC](https://discuss.elastic.co/t/can-i-create-aliases-with-month-and-year-in-index-templates/81089/3 "2017-04-04T08:02:14Z")

</div>


