I have documents in a parent/child relation. In a query run on the parent,
I'd like to know, if the found parents have children matching some query. I
don't want to filter only parents with some conditions on the child, but
only get the information, that they have childrens matching some query.
Any idea if that's possible? I've been thinking maybe adding a scrip_field
that would compute that, but have no idea how to run child queries from a
script field.
An example to clarify my problem:
child has a boolean field "error"
I run a query on the parent and want to show an information if any of the
children has the error flag set.
Not sure I understand. So if you run a _search on the parent, and use the
has_child filter to return only parents that match some child condition, is
that not what you want?
I want to return "all" parents (or those matching some other query
conditions) but in addition to the other data in the document, I want to
compute for each parent, if he has any child with a set error flag. I don't
want to filter on this condition in this case.
Am Freitag, 28. März 2014 14:21:30 UTC+1 schrieb Binh Ly:
Not sure I understand. So if you run a _search on the parent, and use the
has_child filter to return only parents that match some child condition, is
that not what you want?
Thanks for the examples. Looks quite interesting. If I understand that
correctly, I'd have to write a plugin doing my subquery. Too bad I don't
have much time right now Sounds like an interesting challenge
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.