mongocli atlas cluster search index update
The search index update
command modifies an Atlas Search index. You can also update an
Atlas Search index through
the Atlas UI or
API.
Syntax
mongocli atlas cluster search|fts index update <index-id> --clusterName <cluster-name> --collection <collection-name> --db <database-name> [ --dynamic ] [ --field <field-name>:<index-type> ] --indexName <index-name> [ --output|-o <output-format> ] [ --profile|-P <profile-name> ] [ --projectId <project-ID> ] [ --searchAnalyzer <analyzer-name> ]
Options
Option | Type | Description | Required? | |
---|---|---|---|---|
<index-id> | string | Unique identifier of the Atlas Search index to modify. | yes | |
--clusterName | string | Name of the cluster. | yes | |
--collection | string | Name of the collection the Atlas Search index is on. | yes | |
--db | string | Name of the database that contains the collection. | yes | |
--dynamic | flag | Whether the Atlas Search index uses dynamic field mappings. This is required if
To learn more, see Static and Dynamic Mappings. | no | |
--field | string | Comma-separated list of fields to index in the following format:
where:
This is required if the index uses static mappings. You cannot set the
| no | |
indexName | string | Name of the Atlas Search index to modify. You cannot change the name of the
Atlas Search index. | yes | |
--output , -o | string | Command output format. Valid values are:
If omitted, the command returns output in the default format. | no | |
--profile , -P | string | Name of the profile where the public and private keys for the project
are set. If omitted, uses the default profile. To learn more about
creating a profile, see Configure the MongoDB CLI. | no | |
--projectId | string | Unique identifier of the project. If omitted, uses the project ID in the profile or environment variable. | no | |
--searchAnalyzer | string | Analyzer to use when searching the index. Value can be one of the following: If omitted, defaults to | no |
Output
The command prints the following fields in the specified format to the terminal if the command succeeds. If the command prints an error, see Troubleshooting for recommended solutions.
Field | Type | Description |
---|---|---|
analyzer | string | Name of the analyzer to use when creating the index. Value can be one of the following: |
collectionName | string | Name of the collection. |
database | string | Name of the database that contains the collection. |
indexID | string | Unique identifier of the Atlas Search index. |
mappings | document | Static or dynamic field mappings for the Atlas Search index. |
mappings.dynamic | string | Whether the Atlas Search index uses dynamic field mappings. Value can be one of the following:
|
mappings.fields | document or array of documents | List of indexed fields. |
mappings.fields.[n].type | string | Data type of the indexed field. |
name | string | Name of the index. |
searchAnalyzer | string | Name of the analyzer to use when searching the indexed field. Value can be one of the following: |
Example
The following example uses the mongocli atlas cluster search index update
command to modify an Atlas Search index named default
on the
sample_mflix.movies
collection in an Atlas cluster named
myTestCluster
to use dynamic field mappings and the lucene.keyword
analyzer. It uses the default profile to access the project.
mongocli atlas cluster search index update 5f2099cd683fc55fbb30bef6 --clusterName myTestCluster --db sample_mflix --collection movies --indexName default --dynamic --searchAnalyzer lucene.keyword --output json
The previous command prints the following fields in the specified format to the terminal. To learn more about these fields, see Output.
{ "analyzer": "lucene.standard", "collectionName": "movies", "database": "sample_mflix", "indexID": "5f2099cd683fc55fbb30bef6", "mappings": { "dynamic": true }, "name": "default", "searchAnalyzer": "lucene.keyword" }