DeleteCollection - Amazon OpenSearch Serverless

DeleteCollection

Deletes an OpenSearch Serverless collection. For more information, see Creating and managing Amazon OpenSearch Serverless collections.

Request Syntax

{ "clientToken": "string", "id": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

clientToken

A unique, case-sensitive identifier to ensure idempotency of the request.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 512.

Required: No

id

The unique identifier of the collection. For example, 1iu5usc406kd. The ID is part of the collection endpoint. You can also retrieve it using the ListCollections API.

Type: String

Length Constraints: Minimum length of 3. Maximum length of 40.

Pattern: ^[a-z0-9]{3,40}$

Required: Yes

Response Syntax

{ "deleteCollectionDetail": { "id": "string", "name": "string", "status": "string" } }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

deleteCollectionDetail

Details of the deleted collection.

Type: DeleteCollectionDetail object

Errors

For information about the errors that are common to all actions, see Common Errors.

ConflictException

When creating a resource, thrown when a resource with the same name already exists or is being created. When deleting a resource, thrown when the resource is not in the ACTIVE or FAILED state.

HTTP Status Code: 400

InternalServerException

Thrown when an error internal to the service occurs while processing a request.

HTTP Status Code: 500

ResourceNotFoundException

Thrown when accessing or deleting a resource that does not exist.

HTTP Status Code: 400

ValidationException

Thrown when the HTTP request contains invalid input or is missing required input.

HTTP Status Code: 400

Examples

Delete a collection

The following example deletes a collection.

Sample Request

POST / HTTP/1.1 Host: aoss.<region>.<domain> Accept-Encoding: identity Content-Length: <PayloadSizeBytes> User-Agent: <UserAgentString> Content-Type: application/x-amz-json-1.0 Authorization: AWS4-HMAC-SHA256 Credential=<Credential>, SignedHeaders=<Headers>, Signature=<Signature> X-Amz-Date: <Date> X-Amz-Target: OpenSearchServerless.DeleteCollection { "id": "07tjusf2h91cunochc", "clientToken": "f576fe66-8dd5-11ec-b909-0242ac120004" }

Sample Response

HTTP/1.1 200 OK x-amzn-RequestId: <RequestId> x-amz-crc32: <Checksum> Content-Type: application/x-amz-json-1.0 Content-Length: <PayloadSizeBytes> Date: <Date> { "deleteCollectionDetail":{ "id":"07tjusf2h91cunochc", "name":"my-collection", "status":"DELETING" } }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: