Search + K

Command Palette

Search for a command to run...

Sign In

Update One Atlas Search Index by Name

PATCH /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/search/indexes/{databaseName}/{collectionName}/{indexName}
Copy endpoint
https://cloud.mongodb.com

Updates one Atlas Search index that you identified with its database, collection name, and index name. Atlas Search indexes define the fields on which to create the index and the analyzers to use when creating the index. To use this resource, the requesting Service Account or API Key must have the Project Data Access Admin role.

Parameters

path Path Parameters

Name Type
groupId required

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.

string
clusterName required

Name of the cluster that contains the collection whose Atlas Search index you want to update.

string
collectionName required

Name of the collection that contains one or more Atlas Search indexes.

string
databaseName required

Label that identifies the database that contains the collection with one or more Atlas Search indexes.

string
indexName required

Name of the Atlas Search index to update.

string

query Query Parameters

Name Type
envelope

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.

boolean
pretty

Flag that indicates whether the response body should be in the prettyprint format.

boolean

Request Body

application/vnd.atlas.2024-05-30+json required

Details to update the Atlas Search index with.

interface SearchIndexUpdateRequest {
definition: TextSearchIndexDefinition

The text search index definition set by the user.

interface TextSearchIndexDefinition {
analyzer?: "lucene.standard" | "lucene.simple" | "lucene.whitespace" | "lucene.keyword" | "lucene.arabic" | "lucene.armenian" | "lucene.basque" | "lucene.bengali" | "lucene.brazilian" | "lucene.bulgarian" | "lucene.catalan" | "lucene.chinese" | "lucene.cjk" | "lucene.czech" | "lucene.danish" | "lucene.dutch" | "lucene.english" | "lucene.finnish" | "lucene.french" | "lucene.galician" | "lucene.german" | "lucene.greek" | "lucene.hindi" | "lucene.hungarian" | "lucene.indonesian" | "lucene.irish" | "lucene.italian" | "lucene.japanese" | "lucene.korean" | "lucene.kuromoji" | "lucene.latvian" | "lucene.lithuanian" | "lucene.morfologik" | "lucene.nori" | "lucene.norwegian" | "lucene.persian" | "lucene.portuguese" | "lucene.romanian" | "lucene.russian" | "lucene.smartcn" | "lucene.sorani" | "lucene.spanish" | "lucene.swedish" | "lucene.thai" | "lucene.turkish" | "lucene.ukrainian";
analyzers?: AtlasSearchAnalyzer[];
mappings: SearchMappings;
numPartitions?: number;
searchAnalyzer?: "lucene.standard" | "lucene.simple" | "lucene.whitespace" | "lucene.keyword" | "lucene.arabic" | "lucene.armenian" | "lucene.basque" | "lucene.bengali" | "lucene.brazilian" | "lucene.bulgarian" | "lucene.catalan" | "lucene.chinese" | "lucene.cjk" | "lucene.czech" | "lucene.danish" | "lucene.dutch" | "lucene.english" | "lucene.finnish" | "lucene.french" | "lucene.galician" | "lucene.german" | "lucene.greek" | "lucene.hindi" | "lucene.hungarian" | "lucene.indonesian" | "lucene.irish" | "lucene.italian" | "lucene.japanese" | "lucene.korean" | "lucene.kuromoji" | "lucene.latvian" | "lucene.lithuanian" | "lucene.morfologik" | "lucene.nori" | "lucene.norwegian" | "lucene.persian" | "lucene.portuguese" | "lucene.romanian" | "lucene.russian" | "lucene.smartcn" | "lucene.sorani" | "lucene.spanish" | "lucene.swedish" | "lucene.thai" | "lucene.turkish" | "lucene.ukrainian";
sort?: {};
storedSource?: {};
synonyms?: SearchSynonymMappingDefinition[];
typeSets?: SearchTypeSets[];
}
& {}
| VectorSearchIndexDefinition

The vector search index definition set by the user.

interface VectorSearchIndexDefinition {
fields?: BasicDBObject[];
numPartitions?: number;
storedSource?: {};
}
& {}
;
}

Responses

200 application/vnd.atlas.2024-05-30+json

OK

interface SearchIndexResponse {
collectionName?: string;
database?: string;
indexID?: string;
latestDefinition?: SearchIndexDefinition

The search index definition set by the user.

interface SearchIndexDefinition {
numPartitions?: number;
storedSource?: {};
}
;
latestDefinitionVersion?: SearchIndexDefinitionVersion

Object which includes the version number of the index definition and the time that the index definition was created.

interface SearchIndexDefinitionVersion {
createdAt?: string;
version?: number;
}
;
name?: string;
queryable?: boolean;
status?: "DELETING" | "FAILED" | "STALE" | "PENDING" | "BUILDING" | "READY" | "DOES_NOT_EXIST";
statusDetail?: SearchHostStatusDetail
interface SearchHostStatusDetail {
hostname?: string;
mainIndex?: SearchMainIndexStatusDetail;
queryable?: boolean;
stagedIndex?: SearchStagedIndexStatusDetail;
status?: "DELETING" | "FAILED" | "STALE" | "PENDING" | "BUILDING" | "READY" | "DOES_NOT_EXIST";
}
[]
;
type?: "search" | "vectorSearch";
}

Client Errors

400 application/json

Bad Request.

interface ApiError {
badRequestDetail?: BadRequestDetail

Bad request detail.

interface BadRequestDetail {
fields?: FieldViolation[];
}
;
detail?: string;
error: number;
errorCode: string;
parameters?: readonly {}[];
reason?: string;
}
401 application/json

Unauthorized.

interface ApiError {
badRequestDetail?: BadRequestDetail

Bad request detail.

interface BadRequestDetail {
fields?: FieldViolation[];
}
;
detail?: string;
error: number;
errorCode: string;
parameters?: readonly {}[];
reason?: string;
}
403 application/json

Forbidden.

interface ApiError {
badRequestDetail?: BadRequestDetail

Bad request detail.

interface BadRequestDetail {
fields?: FieldViolation[];
}
;
detail?: string;
error: number;
errorCode: string;
parameters?: readonly {}[];
reason?: string;
}
404 application/json

Not Found.

interface ApiError {
badRequestDetail?: BadRequestDetail

Bad request detail.

interface BadRequestDetail {
fields?: FieldViolation[];
}
;
detail?: string;
error: number;
errorCode: string;
parameters?: readonly {}[];
reason?: string;
}
409 application/json

Conflict.

interface ApiError {
badRequestDetail?: BadRequestDetail

Bad request detail.

interface BadRequestDetail {
fields?: FieldViolation[];
}
;
detail?: string;
error: number;
errorCode: string;
parameters?: readonly {}[];
reason?: string;
}

Server Errors

500 application/json

Internal Server Error.

interface ApiError {
badRequestDetail?: BadRequestDetail

Bad request detail.

interface BadRequestDetail {
fields?: FieldViolation[];
}
;
detail?: string;
error: number;
errorCode: string;
parameters?: readonly {}[];
reason?: string;
}