Aliasing and Routing Values not being respected by elastic

I recently noticed an issue with my elastic cluster where it seems to ignore the routing values passed into the query and returns documents that belong to another alias.

My index is split into many aliases per:

Looking at my aliases they have the correct routing values. Also this doesn't seem to by cluster wide. Not every alias can see every document, and there doesn't seem to be an alias that can see all documents. There are just specific aliases that seem to share with each-other.


Routing ensures that all documents with the same routing value ends up in the same shard. That does not mean that only data with that routing value will be present in that shard. If you want the alias to only see a subset of values, you need to combine it with a filter.

I'm confused by that. isn't that what "search_routing" accomplishes? If it needs a filter then why can't I find any document with any alias?


If you search with routing, only a single shard is searched. This will contain all documents indexed with that routing key, but also other documents. As only one single shard is searched, only a subset of documents can be returned.

Ah, that makes sense. So it just gets me to the shard reducing the number of documents I have to sift through, but If another alias is on the same shard it can see the same stuff. I still have to account for filtering that subset. Thanks for the explanation!

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