Meta().ID NOT IN performance so slow

I have the following query

SELECT meta().id FROM test WHERE meta().id NOT IN [“1000011”,“1000249”,“1003026”,“1003614”,“1003699”,“1003764”] AND type=‘com.test.doc2’

And I have a matching index

CREATE INDEX idx_test ON test (META().id) where type=‘com.test.doc2’;

If I put 2000 ids (or any large number) inside the array, performance suffers and I keep getting timeouts, is using NOT IN in this case wrong? What’s the proper way to do this in N1QL?

Thanks

NOT IN is special case , you need to convert into ranges or scan everything and ignore one in array. Also evaluation increases if number of elements increases you need to evaluate everything decide not present. There are improvements in next release when IN clause increases do hashing vs serial evaluation.