Need filter filed with empty array using filter of vector search

Can’t use match in aggregate because I am getting top 10 in vector search

Tried filtering using size eq to 0 and comparing array is also not supported in vector search filtering

Getting this error
Command failed with error 8 (UnknownError): ‘PlanExecutor error during aggregation :: caused by :: “filter[0].tags.$eq” must be a boolean, objectId, number, string, date, uuid, or null’

Hello @karthik_55555 can you share the pipeline you are trying to run (removing the Vector so it’s not too long)?

There are a couple options for filtering results from a $vectorSearch query. First you can use the filter field inside $vectorSearch which is a “prefilter” so as we traverse the index we will filter out results that don’t match the filter. This lets you set a limit of 10 and always get 10 as long as there are 10 documents in your collection that match the filter.

If you use $match after a $vectorSearch that would be a ‘post filter’ so the vector search will return the number that matches the limit (e.g. 10) and then those 10 results are passed through the ‘post filter’ and any that do not match are removed. So if all 10 results from the initial $vectorSearch stage do not match the $match, then you will get 0 results at the end.

The error you’re seeing I’m guessing is coming from trying to filter on a field type that is not supported in the filter field inside $vectorSearch. What type of field are you trying to filter on?