假设我在 index1 中有 100 条记录,在 index2 中有 10 条记录。我想得到这样的:
select * from index1 where id not in (select id from index2)
我们是否可以在弹性搜索中进行相同的上述查询,或者甚至有可能。
我尝试了多个索引搜索并且它正在工作,但是我不知道过滤器部分。我正在使用 elasticsearch-7.3.0
请建议!
下面的查询我试过:
GET index1/_search
{
"query": {
"bool": {
"must_not": [
{
"terms": {
"id.keyword": {
"index" : "index2",
"id" : "_all",
"path" : "id"
}
}
}
]
}
}
}