Hello, I have a collection with an embedding field and other fields with 2 million records, when I perform the filter in $vectorsearch, it becomes very slow
var pipeline = new
{
new BsonDocument(“$vectorSearch”, new BsonDocument
{
{ “index”, indexName },
{ “path”, “embedding” },
{ “queryVector”, new BsonArray(parameter.Embeddings) },
{ “numCandidates”, 150 },
{ “limit”, 100 },
{ “exact”, false },
{ “filter”, new BsonDocument{{ “CountryCode”, “USA” }} }
})
};
var results = await context.Database.GetCollection(“Embedding”).Aggregate(pipeline).ToListAsync();
here is my index
{
“fields”: [
{
“numDimensions”: 768,
“path”: “embedding”,
“similarity”: “cosine”,
“type”: “vector”
},
{
“path”: “CountryCode”,
“type”: “filter”
}
]
}