Set subtraction from original index to other index


(Ali Syed) #1

Is it possible to write a query like:

SELECT * FROM ORIGINAL as O where O._id NOT IN (
SELECT _id FROM OTHER_1
);

I've tried looking on Google, the best that I could do is:

GET OTHER_1/_search
{
"query": {
"match_all": {}
}
}

GET ORIGINAL /_search
{
"size": 100,
"_source": "tracking_number",
"query": {
"bool": {
"must_not": {
"terms": { "tracking_number": [1] }
}
}
}
}

Original has 30k records. The Other_1 has about 10k.

This query still doesn't find a perfect set subtraction based on my random sample.

Thanks


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.