having a parent doc_type A and children doc_type B. Is there a way to query "all the A documents where NONE/ALL of their Bs children matches some filters"?
Oh, now I look at it, I think maybe you don't need what I said.
You just need to say (in pseudo code!)
query {
must not {
has child {
must {
{ "match": { "user_id": 200 }}
}
}
}
}
I think you're saying "Give me parents that have a child that doesn't have 200", whereas you need to be saying "Give me parents that do NOT have a child that DOES (must) have 200"
bw99, I thought has_child needed to work outside the must_not clause.
I need a query to get parents whose NONE of their children match a certain query. Also, a query to get parents whose ALL of their children match a certain query.
Finally we've modeled the data in order to not depend on this query, but it'd be interesting know if there is a way in ES to do this.
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.