What is the Top Children query for?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

What is the Top Children query for?

Nick Hoffman
Hi guys. I've read the documentation for the Top Children query[1], but don't understand what the query's purpose is. Could anyone shed some light on when Top Children is useful?

Thanks!
Nick

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: What is the Top Children query for?

Martijn v Groningen
The top_children query allows you to return documents based on matches on other documents. Lets say you index movies and subtitles as separate documents. A movie is a parent and a subtitle is a child document. The top_children will allows you to return the movies based on query matches in the associated subtitle documents.

Most of times you want to use the has_child query. The top_children doesn't take into account all associated child docs, but only the top matching ones, it basically tries to match as much as child documents to return enough parent hits (based on from and size). The has_child query takes into account all child document irrelevant of how many parent documents are requested. So the top_children query is in most cases faster, but not accurate. The has_child query is accurate, but usually slower then the has_child query.


On 23 July 2013 17:57, Nick Hoffman <[hidden email]> wrote:
Hi guys. I've read the documentation for the Top Children query[1], but don't understand what the query's purpose is. Could anyone shed some light on when Top Children is useful?

Thanks!
Nick

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Met vriendelijke groet,

Martijn van Groningen

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.