问题描述
我是ElasticSearch的新手,我正在努力解决这个问题。基本上我想做的是这样的(SQL示例):
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;
我想要一个从TableA返回所有信息的查询,但只有当TableA的ID为等于TableB的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.
提前感谢
推荐答案
此答案由Adrien Grand on a ElasticSearch组:
This answer was given by Adrien Grand on a ElasticSearch group:
如果id字段是您的PK,您可以通过将B作为A的子代(使用父/子)进行索引,然后在A中搜索有孩子的所有文档B。
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.
这篇关于可以在Query DSL上比较不同类型的两个字段吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!