Docs Menu

Docs HomeMongoDB Atlas

Perform Semantic Search with Atlas Vector Search

On this page

  • Overview
  • Procedure

You can perform semantic search on data in your Atlas cluster running MongoDB v6.0.11 or later using Atlas Vector Search. You can store vector embeddings for any kind of data along with other data in your collection on the Atlas cluster. Atlas Vector Search supports embeddings that are less than and equal to 2048 dimensions in width.

When you define an Atlas Vector Search index on your collection, you can seamlessly index vector data along with your other data and then perform semantic search against the indexed fields.

Atlas Vector Search uses the Hierarchical Navigable Small Worlds algorithm to perform the semantic search. You can use Atlas Vector Search support for aNN queries to search for results similar to a selected product, search for images, etc.

This section describes how to index vector embeddings in your data on an Atlas cluster and run queries that search vector embeddings.

1

Use the knnVector field type to index vector data in your collection. To learn more, see How to Index Vector Embeddings for Vector Search.

2

Use the $vectorSearch pipeline stage in your query.

{
"$vectorSearch": {
"index": "<index-name>",
...
}
}

To learn more about this pipeline stage, see Run Vector Search Queries.

3

Use vectorSearchScore in the $project stage after your $vectorSearch stage to retrieve the score for the documents in the results. To learn more, see Score the Documents in the Results.

4

Verify your query syntax and then run it using Atlas Search Tester UI or mongosh.

←  Atlas Search ChangelogHow to Index Vector Embeddings for Vector Search →

On this page

Share Feedback