2 identical aliases, different results

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'
{
"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?

--

Hi,

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

Thanks!

--

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

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

--

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

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

--

Thanks for the explanation!

--