|
| 1 | +.. _ak8so-atlas-search: |
| 2 | + |
| 3 | +============================================ |
| 4 | +Create an |fts| Index with |k8s| |
| 5 | +============================================ |
| 6 | + |
| 7 | +.. default-domain:: mongodb |
| 8 | + |
| 9 | +.. contents:: On this page |
| 10 | + :local: |
| 11 | + :backlinks: none |
| 12 | + :depth: 1 |
| 13 | + :class: singlecol |
| 14 | + |
| 15 | +|ak8so| supports |fts| indexes on |service| clusters. To learn more see |
| 16 | +:ref:`ref-create-index`. |
| 17 | + |
| 18 | +Prerequisites |
| 19 | +------------- |
| 20 | + |
| 21 | +- Running |k8s| cluster with |
| 22 | + |ak8so| :ref:`deployed <ak8so-quick-start-ref>`. |
| 23 | + |
| 24 | +- MongoDB version ``4.2`` or higher on any {+cluster+} tier. |
| 25 | + |
| 26 | + .. note:: |
| 27 | + |
| 28 | + You can't create more than: |
| 29 | + |
| 30 | + - 3 indexes on ``M0`` clusters. |
| 31 | + - 5 indexes on ``M2`` clusters. |
| 32 | + - 10 indexes on ``M5`` clusters. |
| 33 | + |
| 34 | + There are no limits to the number of indexes you can create on |
| 35 | + ``M10+`` clusters. |
| 36 | + |
| 37 | +- Collection to create the |fts| index for. |
| 38 | + |
| 39 | +Required Access |
| 40 | +--------------- |
| 41 | + |
| 42 | +You must have one of the following roles to create |fts| indexes: |
| 43 | + |
| 44 | +- :authrole:`Project Search Index Editor` |
| 45 | +- :authrole:`Project Data Access Admin` |
| 46 | + |
| 47 | +You must have at least the :atlasrole:`readWriteAnyDatabase` role or |
| 48 | +:ref:`readWrite <atlas-specific-privileges>` access to the database |
| 49 | +where you want to create the indexes. To learn more, see |
| 50 | +:ref:`atlas-user-privileges` or :ref:`atlas-specific-privileges`. |
| 51 | + |
| 52 | +Procedure |
| 53 | +--------- |
| 54 | + |
| 55 | +.. procedure:: |
| 56 | + :style: normal |
| 57 | + |
| 58 | + .. step:: Configure an :ref:`atlassearchindexconfig-custom-resource`. |
| 59 | + |
| 60 | + The following example shows an ``AtlasSearchIndexConfig`` custom |
| 61 | + resource specification configured for the ``lucene.standard`` |
| 62 | + analyzer method. |
| 63 | + |
| 64 | + .. note:: |
| 65 | + |
| 66 | + Multiple ``atlasDeployment`` custom resources can reference |
| 67 | + the same ``atlasSearchIndexConfiguration`` custom resource. |
| 68 | + |
| 69 | + **Example:** |
| 70 | + |
| 71 | + Run the following command: |
| 72 | + |
| 73 | + .. code-block:: |
| 74 | + |
| 75 | + cat <<EOF | kubectl apply -f - |
| 76 | + apiVersion: atlas.mongodb.com/v1 |
| 77 | + kind: AtlasSearchIndexConfig |
| 78 | + metadata: |
| 79 | + name: atlassearchindexconfig-sample |
| 80 | + namespace: mongodb-atlas-system |
| 81 | + spec: |
| 82 | + analyzer: lucene.standard |
| 83 | + searchAnalyzer: lucene.standard |
| 84 | + EOF |
| 85 | + |
| 86 | + To learn more about the available parameters, see |
| 87 | + :ref:`atlassearchindexconfig-custom-resource`. |
| 88 | + |
| 89 | + .. step:: Configure the :ref:`atlasdeployment-custom-resource`. |
| 90 | + |
| 91 | + Configure the :setting:`spec.deploymentSpec.searchIndexes` |
| 92 | + object. |
| 93 | + |
| 94 | + The following parameters apply to this object: |
| 95 | + |
| 96 | + .. list-table:: |
| 97 | + :widths: 25 75 |
| 98 | + :header-rows: 1 |
| 99 | + |
| 100 | + * - Parameter |
| 101 | + - Description |
| 102 | + |
| 103 | + * - ``DBName`` |
| 104 | + - Human-readable label that identifies the existing |
| 105 | + database that contains the collection with one or more |
| 106 | + |fts| indexes. |
| 107 | + |
| 108 | + .. important:: |
| 109 | + |
| 110 | + The database that you specify must already exist. If |
| 111 | + you don't have an existing database, |
| 112 | + :atlas:`create one </create-connect-deployments/>`. |
| 113 | + |
| 114 | + * - ``CollectionName`` |
| 115 | + - Human-readable label that identifies the collection that |
| 116 | + contains one or more |fts| indexes. |
| 117 | + |
| 118 | + * - ``Type`` |
| 119 | + - Type of the index. |service| accepts the following values: |
| 120 | + |
| 121 | + - ``search`` |
| 122 | + - ``vectorSearch`` |
| 123 | + |
| 124 | + * - ``search.searchIndexConfigurationRef.name`` |
| 125 | + - Name that references the |
| 126 | + :ref:`atlassearchindexconfig-custom-resource`. |
| 127 | + |
| 128 | + * - ``search.searchIndexConfigurationRef.namespace`` |
| 129 | + - Namespace that contains the |
| 130 | + :ref:`atlassearchindexconfig-custom-resource`. |
| 131 | + |
| 132 | + To learn more about the available parameters, see |
| 133 | + :ref:`atlasdeployment-custom-resource`. |
| 134 | + |
| 135 | + **Example:** |
| 136 | + |
| 137 | + Run the following command. |
| 138 | + |
| 139 | + .. code-block:: sh |
| 140 | + :emphasize-lines: 24-34 |
| 141 | + |
| 142 | + cat <<EOF | kubectl apply -f - |
| 143 | + apiVersion: atlas.mongodb.com/v1 |
| 144 | + kind: AtlasDeployment |
| 145 | + metadata: |
| 146 | + name: my-atlas-cluster |
| 147 | + namespace: mongodb-atlas-system |
| 148 | + spec: |
| 149 | + projectRef: |
| 150 | + name: my-project |
| 151 | + deploymentSpec: |
| 152 | + backupEnabled: true |
| 153 | + clusterType: REPLICASET |
| 154 | + name: Test-cluster-M10 |
| 155 | + replicationSpecs: |
| 156 | + - regionConfigs: |
| 157 | + - backingProviderName: AWS |
| 158 | + electableSpecs: |
| 159 | + instanceSize: M10 |
| 160 | + nodeCount: 3 |
| 161 | + priority: 7 |
| 162 | + providerName: AWS |
| 163 | + regionName: US_EAST_1 |
| 164 | + zoneName: Zone 1 |
| 165 | + searchIndexes: |
| 166 | + - DBName: sample_airbnb |
| 167 | + collectionName: listingsAndReviews |
| 168 | + name: my-index |
| 169 | + search: |
| 170 | + mappings: |
| 171 | + dynamic: true |
| 172 | + searchConfigurationRef: |
| 173 | + name: atlassearchindexconfig-sample |
| 174 | + namespace: mongodb-atlas-system |
| 175 | + type: search |
| 176 | + terminationProtectionEnabled: false |
| 177 | + EOF |
0 commit comments