# ElasticSearch doesn't support date math for alias when create index template yet?

**URL:** <https://discuss.elastic.co/t/elasticsearch-doesnt-support-date-math-for-alias-when-create-index-template-yet/279368>\
**Category:** Elasticsearch\
**Created:** [July 22, 2021, 11:14am UTC](https://discuss.elastic.co/t/elasticsearch-doesnt-support-date-math-for-alias-when-create-index-template-yet/279368 "2021-07-22T11:14:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnPhilip](https://avatars.discourse-cdn.com/v4/letter/j/57b2e6/32.png) [@JohnPhilip](https://discuss.elastic.co/u/JohnPhilip)\
**Post date:** [July 22, 2021, 11:14am UTC](https://discuss.elastic.co/t/elasticsearch-doesnt-support-date-math-for-alias-when-create-index-template-yet/279368/1 "2021-07-22T11:14:08Z")

</div>

It seems that [date math support index alias names in 7.13](https://www.elastic.co/guide/en/elasticsearch/reference/7.13/date-math-index-names.html), but using date math when creating index template is still wrong, here is the curl cmd and result I get when create template with date math alias

```auto
#cmd
curl -XPUT "localhost:9200/_template/test?pretty" -H "Content-Type:application/json" -d '{
    "index_patterns": [
        "test-*"
    ],
    "order": 0,
    "aliases": {
        "<test-{now/h}>": {}
    }
}'
# result
{
    "error": {
        "root_cause": [
            {
                "type": "invalid_alias_name_exception",
                "reason": "Invalid alias name [<test-{now/h}>]: must not contain the following characters [, \", *, \\, <, |, ,, >, /, ?]"
            }
        ],
        "type": "invalid_alias_name_exception",
        "reason": "Invalid alias name [<test-{now/h}>]: must not contain the following characters [, \", *, \\, <, |, ,, >, /, ?]"
    },
    "status": 400
}

```

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [July 22, 2021, 2:58pm UTC](https://discuss.elastic.co/t/elasticsearch-doesnt-support-date-math-for-alias-when-create-index-template-yet/279368/2 "2021-07-22T14:58:53Z")

</div>

Are you using version 7.13 or newer? See [Date math support for aliases by Tommmster · Pull Request #67226 · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/pull/67226)

---

<div class="post-metadata">

**Author:** ![JohnPhilip](https://avatars.discourse-cdn.com/v4/letter/j/57b2e6/32.png) [@JohnPhilip](https://discuss.elastic.co/u/JohnPhilip)\
**Post date:** [July 22, 2021, 3:32pm UTC](https://discuss.elastic.co/t/elasticsearch-doesnt-support-date-math-for-alias-when-create-index-template-yet/279368/3 "2021-07-22T15:32:21Z")

</div>

Hi spinscale,  
I'm using [7.13.4 docker](https://www.elastic.co/guide/en/elasticsearch/reference/7.13/docker.html) for my test. I've seen the pr, and you mean it already supports date math expression when create template? from this [commit](https://github.com/elastic/elasticsearch/pull/67226/commits/ada346aadc05c67794e22a9193229db05669ddbd) it seems that already support, why my test in 7.13.4 got an error?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [July 23, 2021, 8:27am UTC](https://discuss.elastic.co/t/elasticsearch-doesnt-support-date-math-for-alias-when-create-index-template-yet/279368/4 "2021-07-23T08:27:19Z")

</div>

I opened an issue at [Date Math Support for Aliases does not work in Index Templates · Issue #75651 · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/issues/75651)

---

<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:** [August 20, 2021, 8:27am UTC](https://discuss.elastic.co/t/elasticsearch-doesnt-support-date-math-for-alias-when-create-index-template-yet/279368/5 "2021-08-20T08:27:45Z")

</div>

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