# Automatic index alias assigning

**URL:** <https://discuss.elastic.co/t/automatic-index-alias-assigning/7165>\
**Category:** Elasticsearch\
**Created:** [March 28, 2012, 3:15pm UTC](https://discuss.elastic.co/t/automatic-index-alias-assigning/7165 "2012-03-28T15:15:18Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [March 28, 2012, 3:15pm UTC](https://discuss.elastic.co/t/automatic-index-alias-assigning/7165/1 "2012-03-28T15:15:18Z")

</div>

Hello all,

```
     Is there any way to automatically assign and index alias upon it's

```

creation, based on a pattern  
For example, twitter-\* =\> twitter and so upon creation of  
"twitter-2012-03-28" would be automatically assigned to "twitter"

Cheers,  
Thiago Souza

---

<div class="post-metadata">

**Author:** ![Michael\_Sick](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@Michael\_Sick](https://discuss.elastic.co/u/Michael_Sick)\
**Post date:** [March 28, 2012, 3:18pm UTC](https://discuss.elastic.co/t/automatic-index-alias-assigning/7165/2 "2012-03-28T15:18:47Z")

</div>

See:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

On Wed, Mar 28, 2012 at 11:15 AM, Thiago Souza [tcostasouza@gmail.com](mailto:tcostasouza@gmail.com)wrote:

> Hello all,
> 
> ```
> Is there any way to automatically assign and index alias upon
> 
> ```
> 
> it's creation, based on a pattern  
> For example, twitter-\* =\> twitter and so upon creation of  
> "twitter-2012-03-28" would be automatically assigned to "twitter"
> 
> Cheers,  
> Thiago Souza

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [March 28, 2012, 5:54pm UTC](https://discuss.elastic.co/t/automatic-index-alias-assigning/7165/3 "2012-03-28T17:54:26Z")

</div>

Hi Michael,

```
 This is great! But how do I set the alias? I can find de documentation

```

on how to add an index alias, but when setting up a new index, how to  
declare the aliases?

Cheers

On Wed, Mar 28, 2012 at 12:18, Michael Sick \<[michael.sick@serenesoftware.com](mailto:michael.sick@serenesoftware.com)

> wrote:

> See:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-templates.html)
> 
> On Wed, Mar 28, 2012 at 11:15 AM, Thiago Souza [tcostasouza@gmail.com](mailto:tcostasouza@gmail.com)wrote:
> 
> > Hello all,
> > 
> > ```
> > Is there any way to automatically assign and index alias upon
> > 
> > ```
> > 
> > it's creation, based on a pattern  
> > For example, twitter-\* =\> twitter and so upon creation of  
> > "twitter-2012-03-28" would be automatically assigned to "twitter"
> > 
> > Cheers,  
> > Thiago Souza

---

<div class="post-metadata">

**Author:** ![Michael\_Sick](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@Michael\_Sick](https://discuss.elastic.co/u/Michael_Sick)\
**Post date:** [March 28, 2012, 6:14pm UTC](https://discuss.elastic.co/t/automatic-index-alias-assigning/7165/4 "2012-03-28T18:14:44Z")

</div>

In order:

1. create the template
2. create the index
3. create the alias (  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases.html))

you can then redefine the alias as your data changes over time. People  
often use the alias function when doing time based indices.  
--Mike

On Wed, Mar 28, 2012 at 1:54 PM, Thiago Souza [tcostasouza@gmail.com](mailto:tcostasouza@gmail.com) wrote:

> Hi Michael,
> 
> ```
> This is great! But how do I set the alias? I can find de
> 
> ```
> 
> documentation on how to add an index alias, but when setting up a new  
> index, how to declare the aliases?
> 
> Cheers
> 
> On Wed, Mar 28, 2012 at 12:18, Michael Sick \<  
> [michael.sick@serenesoftware.com](mailto:michael.sick@serenesoftware.com)\> wrote:
> 
> > See:  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-templates.html)
> > 
> > On Wed, Mar 28, 2012 at 11:15 AM, Thiago Souza [tcostasouza@gmail.com](mailto:tcostasouza@gmail.com)wrote:
> > 
> > > Hello all,
> > > 
> > > ```
> > > Is there any way to automatically assign and index alias upon
> > > 
> > > ```
> > > 
> > > it's creation, based on a pattern  
> > > For example, twitter-\* =\> twitter and so upon creation of  
> > > "twitter-2012-03-28" would be automatically assigned to "twitter"
> > > 
> > > Cheers,  
> > > Thiago Souza

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [March 28, 2012, 7:08pm UTC](https://discuss.elastic.co/t/automatic-index-alias-assigning/7165/5 "2012-03-28T19:08:48Z")

</div>

Michael,

The index is created automatically (i.e. a document is indexed into non  
existing idex), how can I create the alias, automatically, right after the  
index creation?

Cheers

On Wed, Mar 28, 2012 at 15:14, Michael Sick \<[michael.sick@serenesoftware.com](mailto:michael.sick@serenesoftware.com)

> wrote:

> In order:
> 
> 1. create the template
> 2. create the index
> 3. create the alias (  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases.html)  
> )
> 
> you can then redefine the alias as your data changes over time. People  
> often use the alias function when doing time based indices.  
> --Mike
> 
> On Wed, Mar 28, 2012 at 1:54 PM, Thiago Souza [tcostasouza@gmail.com](mailto:tcostasouza@gmail.com)wrote:
> 
> > Hi Michael,
> > 
> > ```
> > This is great! But how do I set the alias? I can find de
> > 
> > ```
> > 
> > documentation on how to add an index alias, but when setting up a new  
> > index, how to declare the aliases?
> > 
> > Cheers
> > 
> > On Wed, Mar 28, 2012 at 12:18, Michael Sick \<  
> > [michael.sick@serenesoftware.com](mailto:michael.sick@serenesoftware.com)\> wrote:
> > 
> > > See:  
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-templates.html)
> > > 
> > > On Wed, Mar 28, 2012 at 11:15 AM, Thiago Souza [tcostasouza@gmail.com](mailto:tcostasouza@gmail.com)wrote:
> > > 
> > > > Hello all,
> > > > 
> > > > ```
> > > > Is there any way to automatically assign and index alias upon
> > > > 
> > > > ```
> > > > 
> > > > it's creation, based on a pattern  
> > > > For example, twitter-\* =\> twitter and so upon creation of  
> > > > "twitter-2012-03-28" would be automatically assigned to "twitter"
> > > > 
> > > > Cheers,  
> > > > Thiago Souza

---

<div class="post-metadata">

**Author:** ![Michael\_Sick](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@Michael\_Sick](https://discuss.elastic.co/u/Michael_Sick)\
**Post date:** [March 28, 2012, 7:38pm UTC](https://discuss.elastic.co/t/automatic-index-alias-assigning/7165/6 "2012-03-28T19:38:53Z")

</div>

Ahh - no idea offhand. I have done all of my index creation intentionally.  
I know that ES provides information/API's on its inner workings and that  
people are creating plugins that listen to these API's for various reasons.  
I imagine you could listen for such an event and fire the alias command.  
Are you set on allowing lazy creation of the indices?

On Wed, Mar 28, 2012 at 3:08 PM, Thiago Souza [tcostasouza@gmail.com](mailto:tcostasouza@gmail.com) wrote:

> Michael,
> 
> The index is created automatically (i.e. a document is indexed into non  
> existing idex), how can I create the alias, automatically, right after the  
> index creation?
> 
> Cheers
> 
> On Wed, Mar 28, 2012 at 15:14, Michael Sick \<  
> [michael.sick@serenesoftware.com](mailto:michael.sick@serenesoftware.com)\> wrote:
> 
> > In order:
> > 
> > 1. create the template
> > 2. create the index
> > 3. create the alias (  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases.html)  
> > )
> > 
> > you can then redefine the alias as your data changes over time. People  
> > often use the alias function when doing time based indices.  
> > --Mike
> > 
> > On Wed, Mar 28, 2012 at 1:54 PM, Thiago Souza [tcostasouza@gmail.com](mailto:tcostasouza@gmail.com)wrote:
> > 
> > > Hi Michael,
> > > 
> > > ```
> > > This is great! But how do I set the alias? I can find de
> > > 
> > > ```
> > > 
> > > documentation on how to add an index alias, but when setting up a new  
> > > index, how to declare the aliases?
> > > 
> > > Cheers
> > > 
> > > On Wed, Mar 28, 2012 at 12:18, Michael Sick \<  
> > > [michael.sick@serenesoftware.com](mailto:michael.sick@serenesoftware.com)\> wrote:
> > > 
> > > > See:  
> > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-templates.html)
> > > > 
> > > > On Wed, Mar 28, 2012 at 11:15 AM, Thiago Souza [tcostasouza@gmail.com](mailto:tcostasouza@gmail.com)wrote:
> > > > 
> > > > > Hello all,
> > > > > 
> > > > > ```
> > > > > Is there any way to automatically assign and index alias upon
> > > > > 
> > > > > ```
> > > > > 
> > > > > it's creation, based on a pattern  
> > > > > For example, twitter-\* =\> twitter and so upon creation of  
> > > > > "twitter-2012-03-28" would be automatically assigned to "twitter"
> > > > > 
> > > > > Cheers,  
> > > > > Thiago Souza

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [March 28, 2012, 7:45pm UTC](https://discuss.elastic.co/t/automatic-index-alias-assigning/7165/7 "2012-03-28T19:45:05Z")

</div>

Michael,

```
I thought on creating a plugin myself, just wondering if there already

```

wasn't a way of doing it. IMO setting index alias on index templating is  
perfect. I think I'll fire a feature request for this...

Cheers

On Wed, Mar 28, 2012 at 16:38, Michael Sick \<[michael.sick@serenesoftware.com](mailto:michael.sick@serenesoftware.com)

> wrote:

> Ahh - no idea offhand. I have done all of my index creation intentionally.  
> I know that ES provides information/API's on its inner workings and that  
> people are creating plugins that listen to these API's for various reasons.  
> I imagine you could listen for such an event and fire the alias command.  
> Are you set on allowing lazy creation of the indices?
> 
> On Wed, Mar 28, 2012 at 3:08 PM, Thiago Souza [tcostasouza@gmail.com](mailto:tcostasouza@gmail.com)wrote:
> 
> > Michael,
> > 
> > The index is created automatically (i.e. a document is indexed into  
> > non existing idex), how can I create the alias, automatically, right after  
> > the index creation?
> > 
> > Cheers
> > 
> > On Wed, Mar 28, 2012 at 15:14, Michael Sick \<  
> > [michael.sick@serenesoftware.com](mailto:michael.sick@serenesoftware.com)\> wrote:
> > 
> > > In order:
> > > 
> > > 1. create the template
> > > 2. create the index
> > > 3. create the alias (  
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases.html)  
> > > )
> > > 
> > > you can then redefine the alias as your data changes over time. People  
> > > often use the alias function when doing time based indices.  
> > > --Mike
> > > 
> > > On Wed, Mar 28, 2012 at 1:54 PM, Thiago Souza [tcostasouza@gmail.com](mailto:tcostasouza@gmail.com)wrote:
> > > 
> > > > Hi Michael,
> > > > 
> > > > ```
> > > > This is great! But how do I set the alias? I can find de
> > > > 
> > > > ```
> > > > 
> > > > documentation on how to add an index alias, but when setting up a new  
> > > > index, how to declare the aliases?
> > > > 
> > > > Cheers
> > > > 
> > > > On Wed, Mar 28, 2012 at 12:18, Michael Sick \<  
> > > > [michael.sick@serenesoftware.com](mailto:michael.sick@serenesoftware.com)\> wrote:
> > > > 
> > > > > See:  
> > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-templates.html)
> > > > > 
> > > > > On Wed, Mar 28, 2012 at 11:15 AM, Thiago Souza [tcostasouza@gmail.com](mailto:tcostasouza@gmail.com)wrote:
> > > > > 
> > > > > > Hello all,
> > > > > > 
> > > > > > ```
> > > > > > Is there any way to automatically assign and index alias
> > > > > > 
> > > > > > ```
> > > > > > 
> > > > > > upon it's creation, based on a pattern  
> > > > > > For example, twitter-\* =\> twitter and so upon creation of  
> > > > > > "twitter-2012-03-28" would be automatically assigned to "twitter"
> > > > > > 
> > > > > > Cheers,  
> > > > > > Thiago Souza

---

<div class="post-metadata">

**Author:** ![Rossini](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@Rossini](https://discuss.elastic.co/u/Rossini)\
**Post date:** [March 28, 2012, 8:00pm UTC](https://discuss.elastic.co/t/automatic-index-alias-assigning/7165/8 "2012-03-28T20:00:17Z")

</div>

+1  
That would be great.

On Wed, Mar 28, 2012 at 4:45 PM, Thiago Souza [tcostasouza@gmail.com](mailto:tcostasouza@gmail.com) wrote:

> Michael,
> 
> ```
> I thought on creating a plugin myself, just wondering if there already
> 
> ```
> 
> wasn't a way of doing it. IMO setting index alias on index templating is  
> perfect. I think I'll fire a feature request for this...
> 
> Cheers
> 
> On Wed, Mar 28, 2012 at 16:38, Michael Sick \<  
> [michael.sick@serenesoftware.com](mailto:michael.sick@serenesoftware.com)\> wrote:
> 
> > Ahh - no idea offhand. I have done all of my index creation  
> > intentionally. I know that ES provides information/API's on its inner  
> > workings and that people are creating plugins that listen to these API's  
> > for various reasons. I imagine you could listen for such an event and fire  
> > the alias command. Are you set on allowing lazy creation of the indices?
> > 
> > On Wed, Mar 28, 2012 at 3:08 PM, Thiago Souza [tcostasouza@gmail.com](mailto:tcostasouza@gmail.com)wrote:
> > 
> > > Michael,
> > > 
> > > The index is created automatically (i.e. a document is indexed into  
> > > non existing idex), how can I create the alias, automatically, right after  
> > > the index creation?
> > > 
> > > Cheers
> > > 
> > > On Wed, Mar 28, 2012 at 15:14, Michael Sick \<  
> > > [michael.sick@serenesoftware.com](mailto:michael.sick@serenesoftware.com)\> wrote:
> > > 
> > > > In order:
> > > > 
> > > > 1. create the template
> > > > 2. create the index
> > > > 3. create the alias (  
> > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases.html)  
> > > > )
> > > > 
> > > > you can then redefine the alias as your data changes over time. People  
> > > > often use the alias function when doing time based indices.  
> > > > --Mike
> > > > 
> > > > On Wed, Mar 28, 2012 at 1:54 PM, Thiago Souza [tcostasouza@gmail.com](mailto:tcostasouza@gmail.com)wrote:
> > > > 
> > > > > Hi Michael,
> > > > > 
> > > > > ```
> > > > > This is great! But how do I set the alias? I can find de
> > > > > 
> > > > > ```
> > > > > 
> > > > > documentation on how to add an index alias, but when setting up a new  
> > > > > index, how to declare the aliases?
> > > > > 
> > > > > Cheers
> > > > > 
> > > > > On Wed, Mar 28, 2012 at 12:18, Michael Sick \<  
> > > > > [michael.sick@serenesoftware.com](mailto:michael.sick@serenesoftware.com)\> wrote:
> > > > > 
> > > > > > See:  
> > > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-templates.html)
> > > > > > 
> > > > > > On Wed, Mar 28, 2012 at 11:15 AM, Thiago Souza \<[tcostasouza@gmail.com](mailto:tcostasouza@gmail.com)
> > > > > > 
> > > > > > > wrote:
> > > > > > 
> > > > > > > Hello all,
> > > > > > > 
> > > > > > > ```
> > > > > > > Is there any way to automatically assign and index alias
> > > > > > > 
> > > > > > > ```
> > > > > > > 
> > > > > > > upon it's creation, based on a pattern  
> > > > > > > For example, twitter-\* =\> twitter and so upon creation of  
> > > > > > > "twitter-2012-03-28" would be automatically assigned to "twitter"
> > > > > > > 
> > > > > > > Cheers,  
> > > > > > > Thiago Souza

---

<div class="post-metadata">

**Author:** ![Mrc0113](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@Mrc0113](https://discuss.elastic.co/u/Mrc0113)\
**Post date:** [July 2, 2015, 1:21pm UTC](https://discuss.elastic.co/t/automatic-index-alias-assigning/7165/9 "2015-07-02T13:21:16Z")

</div>

I'm trying to do the same thing with time based data. Is this now supported in index templates?  
[Edit] Sorry to bump this - I found a more recent conversation on this here: [https://github.com/elastic/elasticsearch/issues/5359](https://github.com/elastic/elasticsearch/issues/5359)

---

<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:** [July 6, 2017, 12:03am UTC](https://discuss.elastic.co/t/automatic-index-alias-assigning/7165/10 "2017-07-06T00:03:56Z")

</div>


