# 2 identical aliases, different results

**URL:** <https://discuss.elastic.co/t/2-identical-aliases-different-results/9398>\
**Category:** Elasticsearch\
**Created:** [October 17, 2012, 11:11pm UTC](https://discuss.elastic.co/t/2-identical-aliases-different-results/9398 "2012-10-17T23:11:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julien\_Lancien](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@Julien\_Lancien](https://discuss.elastic.co/u/Julien_Lancien)\
**Post date:** [October 17, 2012, 11:11pm UTC](https://discuss.elastic.co/t/2-identical-aliases-different-results/9398/1 "2012-10-17T23:11:09Z")

</div>

Hi,

I am having a very strange problem with aliases. I have a large number of  
queries that I run against an index through an alias that has routing and  
filtering included. When I run the requests, I get 0 results. If I recreate  
the alias, with the same parameters, I get the expected results. Basically  
I have:

$ curl -XGET '[http://localhost:9200/\_aliases](http://localhost:9200/_aliases)'  
{  
"index1": {  
"aliases": {  
"alias1": {  
"filter": {  
"term": {  
"param1": 720  
}  
},  
"index\_routing": "720",  
"search\_routing": "720"  
},  
"alias2": {  
"filter": {  
"term": {  
"param1": 720  
}  
},  
"index\_routing": "720",  
"search\_routing": "720"  
}  
}  
}  
}

I get expected results on alias2 (created to match alias1), and no result  
on alias1.

Ideas?

--

---

<div class="post-metadata">

**Author:** ![Julien\_Lancien](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@Julien\_Lancien](https://discuss.elastic.co/u/Julien_Lancien)\
**Post date:** [October 31, 2012, 7:04pm UTC](https://discuss.elastic.co/t/2-identical-aliases-different-results/9398/2 "2012-10-31T19:04:05Z")

</div>

Hi,

This is still happening and I have absolutely no clue how to debug it. Any  
idea?

Thanks!

--

---

<div class="post-metadata">

**Author:** ![Julien\_Lancien](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@Julien\_Lancien](https://discuss.elastic.co/u/Julien_Lancien)\
**Post date:** [October 31, 2012, 8:19pm UTC](https://discuss.elastic.co/t/2-identical-aliases-different-results/9398/3 "2012-10-31T20:19:55Z")

</div>

So I was able to create a simple test case for  
it: [https://gist.github.com/3989560](https://gist.github.com/3989560)

Hope that will be helpful. Should I submit a bug report?

--

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [October 31, 2012, 11:49pm UTC](https://discuss.elastic.co/t/2-identical-aliases-different-results/9398/4 "2012-10-31T23:49:34Z")

</div>

Thank you for really nice test case! First of all, there is very simple  
workaround for this problem. All you need to do is define path\_id in your  
mapping before adding the first alias and both aliases will start working.

When an alias is added, the alias filter is immediately parsed and stored  
in parsed form for further execution. When you add foobar\_162 the field  
path\_id doesn't exists in the index mapping yet, so the alias filter is  
parsed assuming that path\_id will be a string. However, when the first  
record is added, the path\_id field is added to mapping as "long". As a  
result, when foobar\_162 is used, it tries to filter numeric data using  
string filter, which doesn't work. When foobar\_162\_v2 is added, the filter  
in this alias is parsed using correct type of path\_id. So, you end up with  
two aliases that look exactly the same but internally use two very  
different filters.

On Wednesday, October 31, 2012 4:19:55 PM UTC-4, Julien wrote:

> So I was able to create a simple test case for it:  
> [https://gist.github.com/3989560](https://gist.github.com/3989560)
> 
> Hope that will be helpful. Should I submit a bug report?

--

---

<div class="post-metadata">

**Author:** ![Julien\_Lancien](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@Julien\_Lancien](https://discuss.elastic.co/u/Julien_Lancien)\
**Post date:** [November 1, 2012, 12:32am UTC](https://discuss.elastic.co/t/2-identical-aliases-different-results/9398/5 "2012-11-01T00:32:36Z")

</div>

Thanks for the explanation!

--

---

<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, 3:06am UTC](https://discuss.elastic.co/t/2-identical-aliases-different-results/9398/6 "2017-07-06T03:06:39Z")

</div>


