Atlas Kubernetes Operator は、Atlas クラスター上の Atlas Search インデックスをサポートします。詳細については、 「 MongoDB Search インデックスの管理 」を参照してください。
前提条件
Atlas Kubernetes Operatorがデプロイされた配置で実行中の Kubernetes クラスター。
MongoDB バージョン
4.2以上がインストールされた任意のクラスター階層注意
次の値を超える作成はできません。
M0クラスターで 3 件。Flex クラスターで 10 インデックス。
M10+クラスターで作成できるインデックス数に上限はありません。Atlas Search インデックスを作成するためのコレクション。
必要なアクセス権
Atlas Search インデックスを作成するには、次のいずれかのロールが必要です。
You must have at least the readWriteAnyDatabase role or readWrite access to the database where you want to create the indexes. To learn more, see Built-In Roles or Built-In Roles.
手順
AtlasSearchIndexConfig カスタムリソースを設定します。
次の例では、 lucene.standardアナライザ メソッド用に構成されたAtlasSearchIndexConfigカスタム リソース仕様を示しています。
注意
複数のatlasDeploymentカスタム リソースが同じatlasSearchIndexConfigurationカスタム リソースを参照できます。
例:
次のコマンドを実行します:
cat <<EOF | kubectl apply -f - apiVersion: atlas.mongodb.com/v1 kind: AtlasSearchIndexConfig metadata: name: atlassearchindexconfig-sample namespace: mongodb-atlas-system spec: analyzer: lucene.standard searchAnalyzer: lucene.standard EOF
利用可能なパラメータの詳細については、「 AtlasSearchIndexConfigカスタム リソース 」を参照してください。
AtlasDeployment カスタムリソースを設定します。
spec.deploymentSpec.searchIndexes の構成オブジェクト。
このオブジェクトには次のパラメーターが適用されます。
Parameter | 説明 |
|---|---|
| 1 つ以上の Atlas Search インデックスを持つコレクションを含む既存のデータベースを識別する、人間が判読できるラベル。 重要:指定するデータベースはすでに存在している必要があります。 既存のデータベースがない場合は、作成します 。 |
| 1 つ以上の 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 search: mappings: dynamic: true searchConfigurationRef: name: atlassearchindexconfig-sample namespace: mongodb-atlas-system type: search terminationProtectionEnabled: false EOF