# Is it possible to create aliases on a monthly basis using index templates?

**URL:** https://discuss.elastic.co/t/is-it-possible-to-create-aliases-on-a-monthly-basis-using-index-templates/80850
**Category:** Elasticsearch
**Created:** [March 31, 2017, 4:59pm UTC](https://discuss.elastic.co/t/is-it-possible-to-create-aliases-on-a-monthly-basis-using-index-templates/80850 "2017-03-31T16:59:52Z")
**Posts on this page:** 5
**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: [March 31, 2017, 4:59pm UTC](https://discuss.elastic.co/t/is-it-possible-to-create-aliases-on-a-monthly-basis-using-index-templates/80850/1 "2017-03-31T16:59:52Z")

</div>

HI,

My data comes daily and i want to store in monthly based aliases.

`Template 1`(It have to run for jan month(i.e 31days) after that automatically it have to use Template 2  
{  
"template" : "data-\*",  
"aliases" : {  
"jan-2017" : {}  
}  
}

`Template 2`  
{  
"template" : "data-\*",  
"aliases" : {  
"feb-2017" : {}  
}  
}

Like that it have to go on for 12 months .

Even if i use curator i have to run it for every month with different alias name?

How can i automate it in such a way in index template for a whole year?

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: [March 31, 2017, 10:34pm UTC](https://discuss.elastic.co/t/is-it-possible-to-create-aliases-on-a-monthly-basis-using-index-templates/80850/2 "2017-03-31T22:34:37Z")

</div>

Because you are using date based aliases ES cannot handle that for you.

---

<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 1, 2017, 5:43am UTC](https://discuss.elastic.co/t/is-it-possible-to-create-aliases-on-a-monthly-basis-using-index-templates/80850/3 "2017-04-01T05:43:41Z")

</div>

Thanks..

> [@warkolm](#):
>
> date based aliases ES cannot handle that for you

Then what ES will handle, then i will try on that?

And also can i automate index template in such a way it will run only for a month? Is it possible? How?

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 1, 2017, 8:27am UTC](https://discuss.elastic.co/t/is-it-possible-to-create-aliases-on-a-monthly-basis-using-index-templates/80850/4 "2017-04-01T08:27:35Z")

</div>

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: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [April 29, 2017, 8:27am UTC](https://discuss.elastic.co/t/is-it-possible-to-create-aliases-on-a-monthly-basis-using-index-templates/80850/5 "2017-04-29T08:27:50Z")

</div>

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