Is it possible to compare two fields from different types on a Query DSL?

﹥>﹥吖頭↗ 提交于 2020-01-17 12:38:14

问题


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!


回答1:


This answer was given by Adrien Grand on a ElasticSearch group:

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.



来源:https://stackoverflow.com/questions/29799207/is-it-possible-to-compare-two-fields-from-different-types-on-a-query-dsl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!