How to disable or enable a document when do knn search

Hello, in my index, there are certain documents that I want to disable or hide during a k-nearest neighbors (KNN) search. However, there may be situations where I need to enable or reveal these documents. How can I do this?

Hello @r1ckC139,

When talking about disabling some documents, are you referring to restricting the search? If so, you can consider performing a filtered kNN search. The search will return the top k documents that also match the filter query. In situations that you don’t need it you would simply not perform a filtered search.

Hi there, if i have some documents are not ready to search (no vector-embedding field yet), how can i ignore these documents ?


you can use a filtered search to ignore these documents.

You can add a filter to your k-nearest neighbors (KNN) search query to only include documents where the vector-embedding field exists.


I have tried and found that, documents without embedding fields will be automatically ignored by Elasticsearch.

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