Im trying to understand child/parent/grandparent


(J) #1

im trying to understand child/parent/grandparent, the doc says if you add a child of a parent, it is likely not to be created on the same shard as the grandparent. why?

https://www.elastic.co/guide/en/elasticsearch/guide/current/grandparents.html#grandparents

"document was routed to a shard by its own parent ID—uk. It is very likely that the grandchild would end up on a different shard from its parent and grandparent"

If the child and parent are on the same shard, wouldn't the child of that child get put on the same shard?


(J) #3

I think I understand why you need routing, because the value you pass for _parent is different and it treats it like a string, not an actual lookup to the parent's shard.

shard_num = hash(_routing) % num_primary_shards

_parent = _routing if _routing is not set (its just a string, nothing more)


(J) #4

I need some advice, maybe someone has good strategies for child/parent/grandparent routing number? My child docs don't have a relationship with the grandparent to pull a routing number.


(system) #5

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