I get the following error when executing a vector search via Pymongo:
pymongo.errors.OperationFailure: Unrecognized pipeline stage name: ‘$vectorSearch’, full error: {‘ok’: 0.0, ‘errmsg’: “Unrecognized pipeline stage name: ‘$vectorSearch’”, ‘code’: 40324, ‘codeName’: ‘Location40324’,…
There is a similar thread here, but none of the responses resolve my issue. I have:
- Confirmed a successful connection to my cluster, database, and the appropriate collection (it is not a local instance)
- Confirmed the creation of my vector search index on the “embedding” field, pasted below:
{
"fields": [
{
"numDimensions": 1,
"path": "embedding",
"similarity": "cosine",
"type": "vector"
}
]
}
And below is the query I am making. The embedding is a 1 dimensional array representing an image.
pipeline = [
{
"$vectorSearch": {
"index": "vector_index",
"path": "embedding",
"queryVector": embedding.tolist(),
"numCandidates": 5,
"limit": 5,
}
}
]
results = collection.aggregate(pipeline)
Am I missing something here?