How to do a "subquery"

Hi all

I have data like following

{ "id":1, "name":"Tom", "query":"apple"}
{ "id":2, "name":"Tom", "query":"orange"}
{ "id":3, "name":"Jack", "query":"apple"}
{ "id":4, "name":"Jack", "query":"banana"}

which query/search can i use to get:

"which queries that queried by the men who query orange"

for example:
Tom and Jack query orange
they also query apple and banana

so the result is "apple, orange, banaba"

Zhao Chun

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
To view this discussion on the web visit
For more options, visit