Output of where clause to use as filter


I am new to ES and trying to build a query.
I have tried 5-6 options but not getting desired result.Just want to make sure whether joins can be achieved in ES.Thanks for help.

SQL will be like this

select symbol from stocks where stocks.industry == (select industry from stocks where symbol == 'XYZ')

I will be passing symbol at run time.


Can someone please have a look and confirm whether this is possible or not using ES.

If yes,Please help.Otherwise I will explore other options.


That will as far as I can tell require 2 separate queries in Elasticsearch.

Thanks a lot for replying.

2 queries means one to get first result and then ask server again to send other result using first output.?
I am trying to have less number of request to server.


Exactly. Elasticsearch does not support joins, so you can not feed the results from one query into another in one request.

There is lookup support for the terms query iirc which makes it like a
fairly weak, single layer join.