can anyone please explain how filters works on openserach ? does it first run ANN on all documents and then it runs the filter condition on result set and if filter condition is not met with all documents on result set, it will return empty result ? Examples: I have 1000 documents and I am performing Approx KNN, which has returned 6 documents , let’s say 1, 2…,5 and my finger condition is to perform ANN on document 1, 5, 9 . Now filter condition is not met with the result set, would it give me empty ? or would it return results for document 1 and 2?
In K-NN we have 3 types of filters. Also documentation provides which engine supports what kind of filters. It will be good if you can look at that first and see if it answere the questions. The documentation has flow charts to help understand how filtering works.
does it first run ANN on all documents and then it runs the filter condition on result set and if filter condition is not met with all documents on result set, it will return empty result
This is the boolean filter. The example you provide has potential to return no results. If you want to avoid the above case try to use Efficient filters. It is supported with both Faiss and Lucene engine.
Please let me know if you have follow up questions.