Is it possible to compare two fields from different types in a DSL query?

I am new to ElasticSearch and I am struggling with this issue. Basically what I want to do looks like this (SQL example):

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

I need a query that returns all the information from table A, but only if the identifier from table A is equal to the id from TableB. I read a lot of query filter fields, and I think I could use the Term Field , but I'm not sure how to do this.

Thanks in advance!

0
source share
1 answer

This answer was given by Adrien Grand in the ElasticSearch group:

This SQL query is a join, and in general elasticsearch does not support joins.

If the id field is your PK, you can do this by specifying B as a child of A (using parent / child), and then searching for all documents in A that have a child in B.

-1
source

Source: https://habr.com/ru/post/1242356/


All Articles