# Alias for monthly indices

**URL:** <https://discuss.elastic.co/t/alias-for-monthly-indices/122003>\
**Category:** Elasticsearch\
**Created:** [March 1, 2018, 8:58am UTC](https://discuss.elastic.co/t/alias-for-monthly-indices/122003 "2018-03-01T08:58:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kottapar](https://avatars.discourse-cdn.com/v4/letter/k/a87d85/32.png) [@kottapar](https://discuss.elastic.co/u/kottapar)\
**Post date:** [March 1, 2018, 8:58am UTC](https://discuss.elastic.co/t/alias-for-monthly-indices/122003/1 "2018-03-01T08:58:16Z")

</div>

Hey guys,

We've created an alias perferr for two indices say perf-yyyy.mm and err-yyyy.mm. However when a new index is created the next month we have to run the alias command again.  
Is there any way we can make any new indices created to get auto-aliased 😃

From the documentation "The create index API allows also to provide a set of aliases:"

```
PUT test
{
    "aliases" : {
        "alias_1" : {},
        "alias_2" : {
            "filter" : {
                "term" : {"user" : "kimchy" }
            },
            "routing" : "kimchy"
        }
    }
}

```

But is there any way to specify the alias in the elasticsearch output in logstash?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [March 1, 2018, 2:22pm UTC](https://discuss.elastic.co/t/alias-for-monthly-indices/122003/2 "2018-03-01T14:22:35Z")

</div>

You can define aliases through an [index template](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/indices-templates.html#indices-templates), which will automatically add new indices to the alias as they are created.

---

<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:** [March 29, 2018, 2:22pm UTC](https://discuss.elastic.co/t/alias-for-monthly-indices/122003/3 "2018-03-29T14:22:42Z")

</div>

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