Docs Home / Compass / Interact with Your Data / Manage Indexes

Create an Atlas Vector Search Index创建Atlas矢量搜索索引

New in version 1.42.1.在版本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. 您可以使用MongoDB Compass创建Atlas矢量搜索索引。这些索引使您能够对向量数据和其他数据类型进行索引,这有助于对索引字段进行语义搜索。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.Atlas矢量搜索索引支持通过识别最相似的矢量来索引矢量数据。该索引通过计算查询向量和存储在索引中的向量之间的距离来确定相似性。

About this Task关于此任务

To create an Atlas Search index, your deployment must align with one of the following cases:要创建Atlas搜索索引,部署必须符合以下情况之一:

  • A deployment hosted on MongoDB Atlas and have an Atlas cluster tier of M10 or higher.部署托管在MongoDB Atlas上,Atlas集群层为M10或更高。
  • A local deployment that is set up using the Atlas CLI.使用Atlas CLI设置的本地部署。

Additionally, your deployment must run MongoDB version 7.0 or later.此外,部署必须运行MongoDB 7.0或更高版本。

Steps步骤

1

Open the index creation dialog打开索引创建对话框

From the Indexes tab, click the Create button and then click Search Index.“索引”选项卡中,单击“创建”按钮,然后单击“搜索索引”。

2

Specify a name for the index指定索引的名称

3

Select the Atlas Search Index type选择Atlas搜索索引类型

Select Vector Search.选择“矢量搜索”。

4

Provide the Atlas Vector Search Index configurations提供Atlas矢量搜索索引配置

You must provide all required fields for your vector search index configuration. You can modify the configurations later. For more information on required fields in vector search index configurations, see MongoDB Vector Search Index Fields.您必须为矢量搜索索引配置提供所有必填字段。您可以稍后修改配置。有关矢量搜索索引配置中必填字段的更多信息,请参阅MongoDB矢量搜索索引字段

5

Click Create Search Index单击“创建搜索索引”

Example示例

The following example definition uses the sample_mflix.embedded_movies collection and indexes the plot_embedding field to create an Atlas Vector Search index:以下示例定义使用sample_mflix.embedded_movies集合并对plot_embedding字段进行索引,以创建Atlas矢量搜索索引:

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

Results结果

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 MongoDB Search Index Statuses.有关搜索索引状态的更多信息,请参阅MongoDB搜索索引状态

Learn More了解更多