About This Task
Create a Vector Search Index
In this section, you create a MongoDB Vector Search index on sample data that you load into your cluster:
Run a Vector Search Query
In this section, you run a sample vector search query on your indexed embeddings.
Learning Summary
This quick start focused on retrieving documents from your cluster that contain text that is semantically related to a provided query. However, you can create a vector search index on embeddings that represent any type of data that you might write to your cluster, such as images or videos.
Sample Data
Vector Embeddings
The vector embeddings in the sample_mflix.embedded_movies collection
and in the example query were created using the Voyage AI voyage-3-large
embedding model. Your choice of embedding model informs the vector dimensions
and vector similarity function you use in your vector search index. You can use
any embedding model you like, and it is worth
experimenting with different models as accuracy can vary from model to model
depending on your specific use case.
To learn how to create vector embeddings of your own data, see How to Create Vector Embeddings.
Vector Index Definition
Vector Search Query
The query you ran in this quick start is an aggregation pipeline,
in which the $vectorSearch stage performs an Approximate Nearest Neighbor (ANN)
search followed by a $project stage that refines the results.
To see all the options for a vector search query, including using Exact Nearest Neighbor (ENN) or how
to narrow the scope of your vector search with the filter option,
see Run Vector Search Queries.
Next Steps
To learn how to create embeddings from data and load them into Atlas, see Create Embeddings.
To learn how to implement retrieval-augmented generation (RAG), see Retrieval-Augmented Generation (RAG) with MongoDB.
To integrate MongoDB Vector Search with popular AI frameworks and services, see MongoDB AI Integrations.
To build production ready AI chatbots using MongoDB Vector Search, see the MongoDB Chatbot Framework.
To learn how to implement RAG without the need for API keys or credits, see Build a Local RAG Implementation with MongoDB Vector Search.