Output of where clause to use as filter

(Jitesh) #1


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.


(Jitesh) #2

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.


(Christian Dahlqvist) #3

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

(Jitesh) #4

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.


(Christian Dahlqvist) #5

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

(Nik Everett) #6

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

(system) #7