Python: create vectorsearch index

How it’s possible to create a vectorsearch index programmatically with python?

With langchain-mongodb, I try this:

      self.vectorstore = MongoDBAtlasVectorSearch(
            embedding=embeddings,
            collection=collection,
            index_name=index_name,
        )
        self.vectorstore.create_vector_search_index(
            dimensions=embedding_size,
            filters=None,
            update=False,
        )

but i receive this error:
pymongo.errors.OperationFailure: command not found, full error: {'ok': 0, 'errmsg': 'command not found', 'code': 59, 'codeName': 'CommandNotFound'}

Hi @Philippe_Prados what version of MongoDB Atlas are you running against?

Right now the create_vector_search_index call only works on M10+ clusters running a specific minimum version of Atlas. To see what the prerequisites are, check the information here.