Hi all, I am implementing vector search in my project and I would like to ask which approach is better:
- Using a $match stage before $vectorSearch
- Using filter inside $vectorSearch (pre-filter)
Also I have to use $elemMatch as my filter criteria but it seems like its not supported by $vectorSearch filter
match expression is not supported for $vectorSearch: 2
here is my code so far
{
$vectorSearch: {
index: "vector_index",
path: "CourseEmbeddings",
filter: {
$and: [
{
IsActive: true,
FacilityId: 3,
"Status.Value": 2,
$or: [
{
Facilities: {
$elemMatch: {
_id: { $in: [2] }
}
}
}
]
}
]
},
queryVector: [
-0.0072121937, -0.030757688, 0.014948666
],
numCandidates: 150,
limit: 10
}
}