Question about Query DSL in ElasticSearch

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about Query DSL in ElasticSearch

Tiago Filipe

I'm new to ElasticSearch and I'm struggling with this question. Basically what I want to do is sort of like this (SQL Example):

SELECT A.id
FROM TableA A, TableB B
WHERE A.id = B.id;

I want a Query that returns all of the info from TableA, but only if the id from TableA is equal to an id from TableB. I've read a lot of Query Filter fields and I think I might use the Term Field but I'm not sure how.

Thanks 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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1ad75f69-8623-4dcf-a58c-2a9bfa0eb4a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Question about Query DSL in ElasticSearch

Adrien Grand-3
This SQL query is a join and in general elasticsearch does not support joins.

If the id field is your PK, you might be able to do it by indexing B as a child of A (using parent/child) and then searching for all documents in A that have a child in B.



On Wed, Apr 22, 2015 at 4:11 PM, Tiago Filipe <[hidden email]> wrote:

I'm new to ElasticSearch and I'm struggling with this question. Basically what I want to do is sort of like this (SQL Example):

SELECT A.id
FROM TableA A, TableB B
WHERE A.id = B.id;

I want a Query that returns all of the info from TableA, but only if the id from TableA is equal to an id from TableB. I've read a lot of Query Filter fields and I think I might use the Term Field but I'm not sure how.

Thanks 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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1ad75f69-8623-4dcf-a58c-2a9bfa0eb4a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Adrien

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAO5%3DkAh33ecJ%3DbOmakfopgaDMCn7Lw%2BENjQvx0bV%3Dk5%3DQnUR3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Question about Query DSL in ElasticSearch

Tiago Filipe
Thanks for the reply.

I already found another solution though (not related to ElasticSearch)

Thanks again. 

Em quarta-feira, 22 de abril de 2015 16:07:54 UTC+1, Adrien Grand escreveu:
This SQL query is a join and in general elasticsearch does not support joins.

If the id field is your PK, you might be able to do it by indexing B as a child of A (using parent/child) and then searching for all documents in A that have a child in B.



On Wed, Apr 22, 2015 at 4:11 PM, Tiago Filipe <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="DzICmYgCfLkJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">odeca...@...> wrote:

I'm new to ElasticSearch and I'm struggling with this question. Basically what I want to do is sort of like this (SQL Example):

SELECT A.id
FROM TableA A, TableB B
WHERE A.id = B.id;

I want a Query that returns all of the info from TableA, but only if the id from TableA is equal to an id from TableB. I've read a lot of Query Filter fields and I think I might use the <a href="http://www.elastic.co/guide/en/elasticsearch/reference/1.x/query-dsl-term-query.html" rel="nofollow" style="color:rgb(12,101,165)" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.elastic.co%2Fguide%2Fen%2Felasticsearch%2Freference%2F1.x%2Fquery-dsl-term-query.html\46sa\75D\46sntz\0751\46usg\75AFQjCNE-NdAau4j5-D8dMDAcZOX5Q9h39A';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.elastic.co%2Fguide%2Fen%2Felasticsearch%2Freference%2F1.x%2Fquery-dsl-term-query.html\46sa\75D\46sntz\0751\46usg\75AFQjCNE-NdAau4j5-D8dMDAcZOX5Q9h39A';return true;">Term Field but I'm not sure how.

Thanks 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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="DzICmYgCfLkJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">elasticsearc...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/elasticsearch/1ad75f69-8623-4dcf-a58c-2a9bfa0eb4a7%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/msgid/elasticsearch/1ad75f69-8623-4dcf-a58c-2a9bfa0eb4a7%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;" onclick="this.href='https://groups.google.com/d/msgid/elasticsearch/1ad75f69-8623-4dcf-a58c-2a9bfa0eb4a7%40googlegroups.com?utm_medium\75email\46utm_source\75footer';return true;">https://groups.google.com/d/msgid/elasticsearch/1ad75f69-8623-4dcf-a58c-2a9bfa0eb4a7%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.



--
Adrien

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/62075aad-fab9-4ef1-8f91-d44e6530b691%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.