Create a Vector Search Index
Richa Deshpande avatar
Written by Richa Deshpande
Updated over a week ago

MongoDB Atlas Vector Search will power semantic search and retrieval (chat) capabilities. Set up your index right here in Atlas. Make sure you load data first to create the index on.

Choose the Atlas Vector Search JSON Editor Option. Choose the database “langchain_db” and collection “test”. Or choose your desired database and collection from the list.

Paste in this Index and name it “vector_index_test”:

{
"fields":[
{
"type": "vector",
"path": "embedding",
"numDimensions": 1536,
"similarity": "cosine"
},
{
"type": "filter",
"path": "page"
}
]
}

Click through Next and Create to finish creating the Index.


This index definition specifies indexing the following fields in an index of the vectorSearch type:

  • embedding field as the vector type. The embedding field contains the embeddings created using OpenAI's text-embedding-ada-002 embedding model. The index definition specifies 1536 vector dimensions and measures similarity using cosine.

  • page field as the filter type for pre-filtering data by the page number in the PDF.

Check out our Vector Search documentation for more information on the index configuration settings.

Did this answer your question?