In Parent child relationship, for grand child if I give parent as routing will it sits in the Super parent shard?


(Hanumanth B) #1

I have parent child implementation, For Super parent I wont give the routing and for child will give super parent id as routing so it will sit in the same shard. And for grand child I will give its parent id as routing(I dont want to give super parent as routing)
My concern is will the grand child will sit in the Super parent shard by finding its parent and then parent.s parent shard?


(Zachary Tong) #2

For deep parent-child-grandchild-great_grandchild, etc schemes, any level past the "child" needs to be supplied with the original parent's routing value. If you don't supply the original parent's routing value, the grandchild will be added to the incorrect shard and won't work correctly.

There is a chart on this article (old article, but the chart is still correct). Scroll down to the "Parent/Child/Grandchild schemes" section: https://www.elastic.co/blog/customizing-your-document-routing


(system) #3