Optional parent field for child documents?


(Michael D. Moffitt) #1

Hello,

I'm trying to create parent/child relationships between documents that are
all of the same type. This seems to be working OK, except that to enable
routing, I have to give "top-level" docs a bogus parent (currently ID 0):

 https://gist.github.com/mmoffitt/9144694

Can I somehow omit parent and have it use the child's ID instead? More
importantly, are there more serious problems here, since each child's
parent will be routed based the grandparent's ID (and not its own)?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1205fba8-7b35-40e6-891a-1f729e0a7216%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Binh Ly) #2

You might be interested in this where Zach talks about multi-level
parent-child and how to use routing for those cases:

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ca3e51aa-471b-4c3a-b3c2-e1b937f5b8cb%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Karol Gwaj) #3

BTW, i will suggest you to avoid using parent/child relationships if your
index contains more than million documents per shard
besides the obvious problems with maintaining parent/child/grandchild
relationships, parent/child queries tend to be quite slow and id_cache
(used to store parent/child ids) will consume a lot of java heap space

On Friday, February 21, 2014 10:22:05 PM UTC, Michael D. Moffitt wrote:

Hello,

I'm trying to create parent/child relationships between documents that are
all of the same type. This seems to be working OK, except that to enable
routing, I have to give "top-level" docs a bogus parent (currently ID 0):

 https://gist.github.com/mmoffitt/9144694

Can I somehow omit parent and have it use the child's ID instead? More
importantly, are there more serious problems here, since each child's
parent will be routed based the grandparent's ID (and not its own)?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/71cbb9aa-39ff-4a7d-bdcc-bc48c03d7429%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4