Docs Menu
Docs Home
/
Atlas

Atlas Vector Search Overview

By using Atlas as a vector database, you can use Atlas Vector Search to seamlessly search and index your vector data alongside your other MongoDB data. Atlas Vector Search enables you to query data based on its semantic meaning, combine vector search with full-text search, and filter your queries on other fields in your collection, so you can retrieve the most relevant results for your use case.

Use Atlas Vector Search to power your AI applications and agentic systems by implementing retrieval-augmented generation (RAG). You can also integrate Atlas Vector Search with popular AI frameworks and services to quickly build AI applications and agents.

Get Started with Atlas Vector Search

Note

Atlas Vector Search supports ANN search on clusters running MongoDB v6.0.11, v7.0.2, or later and ENN search on clusters running MongoDB v6.0.16, v7.0.10, v7.3.2, or later.

Vector search is a search method that returns results based on your data's semantic, or underlying, meaning. Unlike traditional full-text search which finds text matches, vector search finds vectors that are close to your search query in multi-dimensional space. The closer the vectors are to your query, the more similar they are in meaning.

By interpreting the meaning of your search query and data, vector search allows you to consider the searcher's intent and search context to retrieve more relevant results.

For example, if you searched for the term "red fruit," full-text search returns only data that explicitly contains these keywords. However, semantic search might return data that is similar in meaning, such as fruits that are red in color like apples or strawberries.

Atlas Vector Search supports the following vector search use cases:

  • Semantic Search: Query your vector embeddings based on semantic similarity by using the ANN or ENN search algorithm.

    To learn more, see How to Perform Semantic Search and Run Vector Search Queries.

  • Hybrid Search: Combine results from multiple search queries, including vector search and full-text search. To learn more, see How to Perform Hybrid Search.

  • Generative Search: Use Atlas Vector Search to retrieve relevant data for your generative AI applications by implementing retrieval-augmented generation (RAG).

    To learn how to implement RAG, see RAG with Atlas Vector Search. To learn how to build AI agents with vector search, including implementing agentic RAG, see Build AI Agents with MongoDB Atlas.

You can use Atlas Vector Search with embedding and generative models from any AI provider. MongoDB and partners also provide specific product integrations to help you leverage Atlas Vector Search in your AI-powered applications. These integrations include frameworks, platforms, and tools that enable you to quickly implement vector search, RAG, and AI agents.

To learn more, see Integrate MongoDB Atlas with AI Technologies.

vector

A vector is an array of numbers that represents your data in multiple dimensions. Vectors can represent any kind of data, from text, image, and audio data to unstructured data. Semantic similarity is determined by measuring the distance between vectors.

Vector dimensions refer to the number of elements in the array, and therefore the number of dimensions in vector space where the vectors are plotted.

Specifically, Atlas Vector Search uses dense vectors, which are a type of high-dimensional vector that favors smaller storage and semantic richness. As opposed to sparse vectors, dense vectors can be packed with more data, which enables Atlas Vector Search to capture more complex relationships.

vector embeddings

Vector embeddings are vectors you use to represent your data. These embeddings capture meaningful relationships in your data and enable tasks like semantic search and retrieval. You create vector embeddings by passing your data through an embedding model, and you can store these embeddings in Atlas as a field in a document.

Atlas Vector Search determines semantic similarity by identifying the vector embeddings that are closest in distance to your query vector.

To learn more, see How to Create Vector Embeddings.

embedding model

Embedding models are algorithms that you use to convert your data into vector embeddings. To do this, embedding models use LLMs, machine learning models trained on a large corpus of data, to generate vector embeddings that capture the semantic meaning of your data.

The embedding model that you choose determines the dimensions of your vector embeddings. You must specify these dimensions as a field in your Atlas Vector Search index.

Embedding models vary depending on how the model was trained. Therefore, different models offer different advantages depending on your data and use case. To learn more, see Choosing an Embedding Model. For state-of-the-art embedding models, use Voyage AI.

To perform vector search on your data in Atlas, you must create an Atlas Vector Search index. Atlas Vector Search indexes are separate from your other database indexes and are used to efficiently retrieve documents that contain vector embeddings at query-time. In your Atlas Vector Search index definition, you index the fields in your collection that contain your embeddings to enable vector search against those fields. Atlas Vector Search supports embeddings that are less than and equal to 8192 dimensions in length.

You can also pre-filter your data by indexing additional fields in your collection that you want to run your Atlas Vector Search queries against. You can filter on boolean, date, objectId, numeric, string, and UUID values, including arrays of these types. Filtering your data narrows the scope of your search and ensures that certain vector embeddings aren't considered for comparison.

To learn how to index fields for Atlas Vector Search, see How to Index Fields for Vector Search.

Atlas Vector Search supports approximate nearest neighbor (ANN) search with the Hierarchical Navigable Small Worlds algorithm and exact nearest neighbor (ENN) search.

To find the most similar vectors, Atlas Vector Search performs ANN search without scanning every vector embedding and ENN search exhaustively on all the indexed vector embeddings. To learn more, see vectorSearch Definition.

Atlas Vector Search queries consist of aggregation pipeline stages where the $vectorSearch stage is the first stage in the pipeline. The process for a basic Atlas Vector Search query is as follows:

  1. You select either ANN or ENN search and specify the query vector, which is the vector embedding that represents your search query.

  2. Atlas Vector Search finds vector embeddings in your data that are closest to the query vector.

  3. Atlas Vector Search returns the documents that contain the most similar vectors.

To customize your vector search query, you can pre-filter your data on fields that you've indexed by using an MQL match expression with supported query or aggregation operators, or you can add additional aggregation stages to further process and organize your results.

To learn how to create and run Atlas Vector Search queries, see Run Vector Search Queries.

For a hands-on experience creating Atlas Vector Search indexes and running Atlas Vector Search queries against sample data, try the Atlas Vector Search Course on MongoDB University and the tutorials in the following pages:

For optimal performance, we recommend deploying separate search nodes for workload isolation. Search Nodes support concurrent query execution to improve individual query latency. To learn more, see Review Deployment Options.

Earn a Skill Badge

Master "Vector Search Fundamentals" for free!

Learn more

On this page