For this you should be using the MQL syntax for the filter, so it should look something like this:
"pre_filter": { "user_id": {"eq": "test_user"}}
(Assuming I’m reading your current filter correctly)
Also, importantly, you will need to make sure that in your index, you are indexing the “user_id” field as a token type, like what is shown here in the “filter” example:
raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: Operand type is not supported for $vectorSearch: object, full error: {'ok': 0.0, 'errmsg': 'Operand type is not supported for $vectorSearch: object', 'code': 7828301, 'codeName': 'Location7828301', '$clusterTime': {'clusterTime': Timestamp(1706711490, 8), 'signature': {'hash': b'CB\xf0\xfe)H>g\x9dxBh\x00q\nl!\x81\xe3\x08', 'keyId': 7270969351082082306}}, 'operationTime': Timestamp(1706711490, 8)}
Also, switching to “type”: “token” in the index doesn’t work, I get this error in the Atlas Search dashboard : “Your index could not be built: “fields[1].type” must be one of [filter, vector]. You are still using your last valid index.”