Is it possible to "left-join" a root document to its associated nested docs in ES?

Hi all,

This is something I've been trying to figure out for quite some time now. I'm asking again here since I'm at my whit's end.

What I'm trying to do is perform the equivalent of the following SQL query:

root r
nested n
ON parent(n) = r
n.x = 1 /
dynamic condition */
To note above is the dynamic condition on the nested documents. Although simple in this example, one can easily imagine situations where aggregations based on multiple dynamic conditions can not be precomputed in advance due to a combinatorial explosion.

The value in the above query is that insights can be gained by aggregating dynamically, while including results that have a value of "0" and preserving a global sort.

Related links:!topic/elasticsearch/Jlk7RgkhBG0

What I have considered is making a "fake" nested document, and filtering this out at the application level in every query. However, this seems quite hacky, inefficient, requires a lot of development time and is error prone.

Any ideas?

Thank you in advance,


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
For more options, visit