Docs Menu
Docs Home
/
MongoDB Compass
/ /

Create an Atlas Vector Search Index

On this page

  • About this Task
  • Steps
  • Example
  • Results
  • Learn More

New in version 1.42.1.

You can create Atlas Vector Search indexes using MongoDB Compass. These indexes enable you to index vector data and other data types, which facilitates semantic searches on the indexed fields. Atlas Vector Search indexes support indexing vector data by identifying the most similar vectors. The index determines similarity by calculating the distance between the query vector and the vectors stored in the index.

To create an Atlas Search index, your deployment must align with one of the following cases:

  • A deployment hosted on MongoDB Atlas and have an Atlas cluster tier of M10 or higher.

  • A local deployment that is set up using the Atlas CLI.

Additionally, your deployment must run MongoDB version 7.0 or later.

1

From the Indexes tab, click the Create button and then click Search Index.

2
3

Select Vector Search.

4

You must initially provide the following default vector search index configurations. You can modify the configurations later.

Field
Type
Description
type
string
Human-readable label that identifies the type of index. The value must be vector to perform a vector search against the indexed fields. If omitted, it defaults to search, which only supports full-text search.
path
string
The field name to index.
numDimensions
int
The number of vector dimensions, which Atlas Search enforces at index- and query-time. This value can't be greater than 4096.
similarity
string

The vector similarity function used to search for the top K-nearest neighbors. Select from the following functions:

Function
Description
euclidean
A function that measures the distance between ends of vectors. This function allows you to measure similarity based on varying dimensions.
cosine

A function that measures similarity based on the angle between vectors. This function allows you to measure similarity that isn't scaled by magnitude.

You can't use zero magnitude vectors with cosine. To measure cosine similarity, we recommend that you normalize your vectors and use dotProduct instead.

dotProduct
A function that measures similarly to cosine, but takes into account the magnitude of the vector. This function allows you to efficiently measure similarity based on both angle and magnitude. To use dotProduct, you must normalize the vector to unit length at index- and query-time.
5

The following example definition uses the sample_mflix.embedded_movies collection and indexes the plot_embedding field to create an Atlas Vector Search index:

{
"fields": [ {
"type": "vector",
"path": "plot_embedding",
"numDimensions": 1536,
"similarity": "euclidean"
} ]
}

To view the status of your created index, go to the Indexes tab and set the toggle at the top-right to Search Indexes.

The Status column indicates the status of the index. When the status is Ready, your index is ready to use.

For more information on search index statuses, see Atlas Search Index Statuses.

Back

Atlas Search Index