Atlas Search Index Configuration File
On this page
You can use an Atlas Search index configuration file to specify the required
settings for creating a search index using the Atlas CLI. The
Atlas CLI accepts .json
search index configuration files.
Atlas Search Index Settings
You can specify the following settings in the Atlas Search index configuration file. For a full list of available settings, see the request body schema in the API specification: Create One Atlas Search Index.
Field | Type | Description |
---|---|---|
collectionName | string | Label that identifies the collection for which you want to
create an Atlas Search index. |
database | string | Label that identifies the database that contains the collection
for which you want to create an Atlas Search index. |
name | string | Label that identifies this index. Within each namespace, names
of all indexes in the namespace must be unique. |
mappings | object | Index specifications for the collection's fields. |
mappings.dynamic | boolean | Flag that indicates whether the index uses dynamic or static
mappings. If omitted or if set to false , mappings.fields is required. To learn more, see
Atlas Search Index Syntax. |
Example Atlas Search Index Configuration File
To create an Atlas Search index, specify the search index details as shown in the following example file:
{ "collectionName": "listingsAndReviews", "database": "sample_airbnb", "name": "myIndex", "mappings": { "dynamic": true } }
Example Atlas Search Index Create Command
After you create the file, run the command to create the Atlas Search search
index and specify the clusterName
and the file
. The
following example creates a search index for the cluster named
myCluster using a JSON index configuration file named
search-config.json:
atlas clusters search indexes create --clusterName myCluster --file /search-config.json --output json