Hello, we are using the following method to search for text based on the embeddings. All works fine, but my question is how are things when having Client-Side Field Level Encryption?
I have just implemented CSFLE encryption on the “text” and “embedding” fields but search is not finding anything… Is this supported or shall I swap CSFLE with Queryable Encryption?
db_collection = get_database_vectorstore()
db = get_database()
vector_search = MongoDBAtlasVectorSearch.from_connection_string(
DB_CONNECTION_STRING,
db.name + "." + db_collection.name,
# TODO: add user specific api key
OpenAIEmbeddings(disallowed_special=()),
index_name="default",
)
retriever = vector_search.as_retriever(
search_type="similarity",
search_kwargs={
"k": 20, #k closest matching documents
"post_filter_pipeline": [
{"$limit": 20},
# sort by score in descending order
{"$sort": {"score": -1}},
# only show results for current user
# TODO: limit initial search space to current user
{"$match": {"user_id": userID}},
# do not show these fields in the result
{"$project": {"embedding": 0, "_id": 0}}],
}
)
Document in collection looks as follows:
_id:ObjectId('6558d872a0489d6266ba29e4')
user_id:"user_1"
session_id:"sess_1"
text:*********
metadata:Object
embedding:*********