For AI agents: a documentation index is available at https://www.mongodb.com/es/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.

Create a Atlas Vector Search Index with Kubernetes

Atlas Kubernetes Operator supports Atlas Vector Search indexes on Atlas clusters. To learn more, see How to Index Fields for Vector Search.

  • Running Kubernetes cluster with Atlas Kubernetes Operator deployed.

  • MongoDB version 6.0.11, 7.0.2, or higher on any cluster tier.

    Note

    You can't create more than:

    • 3 indexes on M0 clusters.

    • 10 indexes on Flex clusters.

    There are no limits to the number of indexes you can create on M10+ clusters.

  • Collection to create the Atlas Vector Search index for.

You need the Project Data Access Admin or higher role to create and manage Atlas Vector Search indexes.

1

Configure the spec.deploymentSpec.searchIndexes object.

The following parameters apply to this object:

Parameter
Description

DBName

Human-readable label that identifies the existing database that contains the collection with one or more Atlas Search indexes.

IMPORTANT: The database that you specify must already exist. If you don't have an existing database, create one.

CollectionName

Human-readable label that identifies the collection that contains one or more Atlas Search indexes.

Type

Type of the index. Atlas accepts the following values:

  • search

  • vectorSearch

To learn more about the available parameters, see AtlasDeployment Custom Resource.

Example:

Run the following command.

cat <<EOF | kubectl apply -f -apiVersion: atlas.mongodb.com/v1kind: AtlasDeploymentmetadata: name: my-atlas-cluster namespace: mongodb-atlas-systemspec: 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: falseEOF