Docs Menu

Docs HomeAtlas CLI

Atlas Search Index Configuration File

On this page

  • Atlas Search Index Settings
  • Example Atlas Search Index Configuration File
  • Example Atlas Search Index Create Command

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.

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.

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
}
}

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
←  Atlas Data Federation Configuration FileAlert Configuration File →

Specify your version

Share Feedback