# Alias created by dynamic template not working

**URL:** <https://discuss.elastic.co/t/alias-created-by-dynamic-template-not-working/51340>\
**Category:** Elasticsearch\
**Created:** [May 30, 2016, 5:02pm UTC](https://discuss.elastic.co/t/alias-created-by-dynamic-template-not-working/51340 "2016-05-30T17:02:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tishma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tishma/32/10026_2.png) [@tishma](https://discuss.elastic.co/u/tishma)\
**Post date:** [May 30, 2016, 5:02pm UTC](https://discuss.elastic.co/t/alias-created-by-dynamic-template-not-working/51340/1 "2016-05-30T17:02:55Z")

</div>

Hi,

{ES v2.3.2}

I've added alias to my dynamic template using aliases field, as explained here: [https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html)

Then I've posted a trivial doc to the new index that matches template pattern.

New index is created, and its \_settings show the alias, but it's ineffective somehow. Neither \_cat/indices shows it nor can I search by alias name.

Am I missing something?

Thanks  
v.

---

<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:** [May 31, 2016, 1:34am UTC](https://discuss.elastic.co/t/alias-created-by-dynamic-template-not-working/51340/2 "2016-05-31T01:34:21Z")

</div>

What does the template look like?

---

<div class="post-metadata">

**Author:** ![tishma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tishma/32/10026_2.png) [@tishma](https://discuss.elastic.co/u/tishma)\
**Post date:** [May 31, 2016, 7:16am UTC](https://discuss.elastic.co/t/alias-created-by-dynamic-template-not-working/51340/3 "2016-05-31T07:16:09Z")

</div>

Hey! Thanks for your willingness to help.

I've found the problem(s) myself:

1. I've put aliases inside settings - wrong. It should be settings' sibling.
2. I'm using php/elastica, so the entire alias index (without filters or such) must be specified like this:  
'alias1' =\> new \stdClass() in order to properly serialize to JSON as stated in the docs ("alias1": {})

I know my question is bad, as it lacks clues to the solution, and problems came from my lack of focus, but I guess these might be useful to someone (esp. 2.) Regarding 1. it's also interesting that aliases field was saved to settings as such, and it was just ignored - no error.

Best

---

<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 5, 2017, 10:47pm UTC](https://discuss.elastic.co/t/alias-created-by-dynamic-template-not-working/51340/4 "2017-07-05T22:47:50Z")

</div>


