# Is there any regex can create index alias based on weekly/monthly/yearly?

**URL:** <https://discuss.elastic.co/t/is-there-any-regex-can-create-index-alias-based-on-weekly-monthly-yearly/101466>\
**Category:** Elasticsearch\
**Created:** [September 22, 2017, 9:55am UTC](https://discuss.elastic.co/t/is-there-any-regex-can-create-index-alias-based-on-weekly-monthly-yearly/101466 "2017-09-22T09:55:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robin\_Guo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/robin_guo/32/42297_2.png) [@Robin\_Guo](https://discuss.elastic.co/u/Robin_Guo)\
**Post date:** [September 22, 2017, 9:55am UTC](https://discuss.elastic.co/t/is-there-any-regex-can-create-index-alias-based-on-weekly-monthly-yearly/101466/1 "2017-09-22T09:55:01Z")

</div>

I want to create different date index alias.  
Is there any regex can create index alias based on weekly/monthly/yearly?  
but the below restful API doesn't work. could anyone help on this?

POST /\_aliases  
{  
"actions": [  
{ "add": { "index": "metricbeat-linux-system-{now/w}", "alias": "system" }}  
]  
}

---

<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:** [September 22, 2017, 9:56am UTC](https://discuss.elastic.co/t/is-there-any-regex-can-create-index-alias-based-on-weekly-monthly-yearly/101466/2 "2017-09-22T09:56:05Z")

</div>

Those APIs don't do date math for you, you need to do it client side and then make the request.

---

<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:** [October 20, 2017, 9:56am UTC](https://discuss.elastic.co/t/is-there-any-regex-can-create-index-alias-based-on-weekly-monthly-yearly/101466/3 "2017-10-20T09:56:29Z")

</div>

Closed on October 20, 2017, 9:56am UTC

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