Recommended way to use aliases and child documents regarding routing


(ronsher) #1

I'm using elasticsearch version 1.7.4.
I've created an alias with routing.
The data lifetime is to start pointing the alias to a common index with routing based on customer ID and when a shard gets too big - move a large customer that resides in that shard out of that common index and point its alias to a separate index (starting with 1 shard and maybe later resharding it if it's again too big).
I want to stop using routing in my code and only rely on the flexibility of using routing in aliases, and later change it, all in the alias.

BUT the problem is that when I tried this I failed to index the child documents in the common index on the following:
"Alias [-----] has index routing associated with it [-----], and was provided with routing value [----], rejecting operation"
Again, I didn't provide the routing for the child document. It automatically used the parent ID.

Looking around I found the following issue: https://github.com/elastic/elasticsearch/issues/3068

I'm wondering if you have a best practice to recommend in the case I've described.


(Ali Beyad) #2

Yes you're correct, it looks like your specific problem would be solved by the issue you linked to. However, its not slated till the next release.

Until then, it appears the only way around it is to specify the routing value explicitly in the indexing request for the child documents.


(system) #3