Atlas Kubernetes Operator supports Atlas Vector Search indexes on Atlas clusters. To learn more, see How to Index Fields for Vector Search.
先决条件
在部署 Atlas Kubernetes Operator 的情况下运行 Kubernetes 集群。
任何集群层上的MongoDB版本
6.0.11、7.0.2或更高版本。注意
您创建的内容不能超过:
在
M0集群上具有 3 个索引。针对 Flex 集群的 10 个索引。
您可以在
M10+集群上创建的索引数量没有限制。要为其创建Atlas Vector Search索引的集合。
必需的访问权限
You need the Project Data Access Admin or higher role to create and manage Atlas Vector Search indexes.
步骤
1
配置 AtlasDeployment 自定义资源。
配置 spec.deploymentSpec.searchIndexes 对象。
以下参数应用于该对象:
Parameter | 说明 |
|---|---|
| 人类可读标签,用于标识包含具有一个或多个 Atlas Search 索引的集合的现有数据库。 重要提示:您指定的数据库必须已经存在。 如果您没有现有数据库,请创建一个。 |
| 可读标签,用于标识包含一个或多个 Atlas Search 索引的集合。 |
| 索引的类型。Atlas 接受以下值:
|
要了解可用参数的更多信息,请参阅 AtlasDeployment 自定义资源。
示例:
运行以下命令。
cat <<EOF | kubectl apply -f - apiVersion: atlas.mongodb.com/v1 kind: AtlasDeployment metadata: name: my-atlas-cluster namespace: mongodb-atlas-system spec: projectRef: name: my-project deploymentSpec: backupEnabled: true clusterType: REPLICASET name: Test-cluster-M10 replicationSpecs: - regionConfigs: - backingProviderName: AWS electableSpecs: instanceSize: M10 nodeCount: 3 priority: 7 providerName: AWS regionName: US_EAST_1 zoneName: Zone 1 searchIndexes: - DBName: sample_airbnb collectionName: listingsAndReviews name: my-index vectorSearch: fields: | [ {"my-field":{"type": "vector", { ...}, ] type: vectorSearch terminationProtectionEnabled: false EOF