【发布时间】:2019-12-03 11:36:42
【问题描述】:
假设我在 index1 中有 100 条记录,在 index2 中有 10 条记录。我想变成这样:
select * from index1 where id not in (select id from index2)
我们能否在 elasticsearch 中使用上述相同的查询,或者甚至有可能。
我尝试了多个索引搜索并且它正在工作,但是我不知道过滤器部分。我正在使用 elasticsearch-7.3.0
请推荐!
我尝试过以下查询:
GET index1/_search
{
"query": {
"bool": {
"must_not": [
{
"terms": {
"id.keyword": {
"index" : "index2",
"id" : "_all",
"path" : "id"
}
}
}
]
}
}
}
【问题讨论】:
-
I have tried multiple index search and it is working。请分享您到目前为止尝试过的内容。 -
@Soumendra:我尝试过更新查询,它只适用于 1 个或某些 id。我需要从另一个索引中过滤掉大约数百万个 ID。更新了我久经考验的查询。
标签: elasticsearch elastic-stack kibana-7