Create One Atlas Search Index
Creates one Atlas Search index on the specified collection. Atlas Search indexes define the fields on which to create the index and the analyzers to use when creating the index. Only clusters running MongoDB v4.2 or later can use Atlas Search. To use this resource, the requesting Service Account or API Key must have the Project Data Access Admin role.
Path parameters
-
Unique 24-hexadecimal digit string that identifies your project. Use the /groups endpoint to retrieve all projects to which the authenticated user has access.
NOTE: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.
Format should match the following pattern:
^([a-f0-9]{24})$
. -
Name of the cluster that contains the collection on which to create an Atlas Search index.
Format should match the following pattern:
^[a-zA-Z0-9][a-zA-Z0-9-]*$
.
Query parameters
-
Flag that indicates whether Application wraps the response in an
envelope
JSON object. Some API clients cannot access the HTTP response headers or status code. To remediate this, set envelope=true in the query. Endpoints that return a list of results use the results object as an envelope. Application adds the status parameter to the response body.Default value is
false
. -
Flag that indicates whether the response body should be in the prettyprint format.
Default value is
false
.Prettyprint
Body
object
Required
Creates one Atlas Search index on the specified collection.
Text Search Index Create Request
-
Label that identifies the collection to create an Atlas Search index in.
-
Label that identifies the database that contains the collection to create an Atlas Search index in.
-
Label that identifies this index. Within each namespace, names of all indexes in the namespace must be unique.
-
Type of the index. The default type is search.
Value is
search
. -
The text search index definition set by the user.
curl \
--request POST 'https://cloud.mongodb.com/api/atlas/v2/groups/32b6e34b3d91647abb20e7b8/clusters/{clusterName}/search/indexes' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/vnd.atlas.2024-05-30+json"
{
"collectionName": "string",
"database": "string",
"name": "string",
"type": "search",
"definition": {
"analyzer": "lucene.standard",
"analyzers": [
{
"charFilters": [
{
"additionalProperty1": {},
"additionalProperty2": {}
}
],
"name": "string",
"tokenFilters": [
{
"additionalProperty1": {},
"additionalProperty2": {}
}
],
"tokenizer": {
"additionalProperty1": {},
"additionalProperty2": {}
}
}
],
"mappings": {
"dynamic": true,
"fields": {
"additionalProperty1": {},
"additionalProperty2": {}
}
},
"numPartitions": 1,
"searchAnalyzer": "lucene.standard",
"storedSource": {
"include | exclude": [
"field1",
"field2"
]
},
"synonyms": [
{
"analyzer": "lucene.standard",
"name": "string",
"source": {
"collection": "string"
}
}
]
}
}
{
"collectionName": "string",
"database": "string",
"name": "string",
"type": "vectorSearch",
"definition": {
"fields": [
{
"additionalProperty1": {},
"additionalProperty2": {}
}
],
"numPartitions": 1
}
}
{
"collectionName": "string",
"database": "string",
"indexID": "32b6e34b3d91647abb20e7b8",
"latestDefinition": {
"numPartitions": 1,
"analyzer": "lucene.standard",
"analyzers": [
{
"charFilters": [
{
"additionalProperty1": {},
"additionalProperty2": {}
}
],
"name": "string",
"tokenFilters": [
{
"additionalProperty1": {},
"additionalProperty2": {}
}
],
"tokenizer": {
"additionalProperty1": {},
"additionalProperty2": {}
}
}
],
"mappings": {
"dynamic": true,
"fields": {
"additionalProperty1": {},
"additionalProperty2": {}
}
},
"searchAnalyzer": "lucene.standard",
"storedSource": {
"include | exclude": [
"field1",
"field2"
]
},
"synonyms": [
{
"analyzer": "lucene.standard",
"name": "string",
"source": {
"collection": "string"
}
}
]
},
"latestDefinitionVersion": {
"createdAt": "2025-05-04T09:42:00Z",
"version": 42
},
"name": "string",
"queryable": true,
"status": "DELETING",
"statusDetail": [
{
"hostname": "string",
"mainIndex": {
"definition": {
"numPartitions": 1
},
"definitionVersion": {
"createdAt": "2025-05-04T09:42:00Z",
"version": 42
},
"message": "string",
"queryable": true,
"status": "DELETING"
},
"queryable": true,
"stagedIndex": {
"definition": {
"numPartitions": 1
},
"definitionVersion": {
"createdAt": "2025-05-04T09:42:00Z",
"version": 42
},
"message": "string",
"queryable": true,
"status": "DELETING"
},
"status": "DELETING"
}
],
"type": "search",
"synonymMappingStatus": "FAILED",
"synonymMappingStatusDetail": [
{
"additionalProperty1": {
"message": "string",
"queryable": true,
"status": "FAILED"
},
"additionalProperty2": {
"message": "string",
"queryable": true,
"status": "FAILED"
}
}
]
}
{
"collectionName": "string",
"database": "string",
"indexID": "32b6e34b3d91647abb20e7b8",
"latestDefinition": {
"numPartitions": 1,
"fields": [
{
"additionalProperty1": {},
"additionalProperty2": {}
}
]
},
"latestDefinitionVersion": {
"createdAt": "2025-05-04T09:42:00Z",
"version": 42
},
"name": "string",
"queryable": true,
"status": "DELETING",
"statusDetail": [
{
"hostname": "string",
"mainIndex": {
"definition": {
"numPartitions": 1
},
"definitionVersion": {
"createdAt": "2025-05-04T09:42:00Z",
"version": 42
},
"message": "string",
"queryable": true,
"status": "DELETING"
},
"queryable": true,
"stagedIndex": {
"definition": {
"numPartitions": 1
},
"definitionVersion": {
"createdAt": "2025-05-04T09:42:00Z",
"version": 42
},
"message": "string",
"queryable": true,
"status": "DELETING"
},
"status": "DELETING"
}
],
"type": "vectorSearch"
}
{
"error": 400,
"detail": "(This is just an example, the exception may not be related to this endpoint) No provider AWS exists.",
"reason": "Bad Request",
"errorCode": "VALIDATION_ERROR"
}
{
"error": 401,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Unauthorized",
"errorCode": "NOT_ORG_GROUP_CREATOR"
}
{
"error": 403,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Forbidden",
"errorCode": "CANNOT_CHANGE_GROUP_NAME"
}
{
"error": 404,
"detail": "(This is just an example, the exception may not be related to this endpoint) Cannot find resource AWS",
"reason": "Not Found",
"errorCode": "RESOURCE_NOT_FOUND"
}
{
"error": 409,
"detail": "(This is just an example, the exception may not be related to this endpoint) Cannot delete organization link while there is active migration in following project ids: 60c4fd418ebe251047c50554",
"reason": "Conflict",
"errorCode": "CANNOT_DELETE_ORG_ACTIVE_LIVE_MIGRATION_ATLAS_ORG_LINK"
}
{
"error": 500,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Internal Server Error",
"errorCode": "UNEXPECTED_ERROR"
}