CreateCollection - Amazon OpenSearch Serverless

CreateCollection

Creates a new OpenSearch Serverless collection. For more information, see Creating and managing Amazon OpenSearch Serverless collections.

Request Syntax

{ "clientToken": "string", "description": "string", "name": "string", "tags": [ { "key": "string", "value": "string" } ], "type": "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

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

Type: String

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

Required: No

description

Description of the collection.

Type: String

Length Constraints: Minimum length of 0. Maximum length of 1000.

Required: No

name

Name of the collection.

Type: String

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

Pattern: ^[a-z][a-z0-9-]+$

Required: Yes

tags

An arbitrary set of tags (key–value pairs) to associate with the OpenSearch Serverless collection.

Type: Array of Tag objects

Array Members: Minimum number of 0 items. Maximum number of 50 items.

Required: No

type

The type of collection.

Type: String

Valid Values: SEARCH | TIMESERIES

Required: No

Response Syntax

{ "createCollectionDetail": { "arn": "string", "createdDate": number, "description": "string", "id": "string", "kmsKeyArn": "string", "lastModifiedDate": number, "name": "string", "status": "string", "type": "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.

createCollectionDetail

Details about the collection.

Type: CreateCollectionDetail 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

ValidationException

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

HTTP Status Code: 400

Examples

Create a collection

The following example creates 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.CreateCollection { "name": "my-collection-name", "description": "collection-description", "clientToken": "f576fe66-8dd5-11ec-b909-0242ac120004", "type": "SEARCH" }

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> { "createCollectionDetail":{ "arn":"arn:aws:aoss:us-east-1:123456789012:collection/07tjusf2h91cunochc", "createdDate":1637012666117, "description":"collection-description", "kmsKeyArn": "auto", "type": "SEARCH", "id":"07tjusf2h91cunochc", "name":"my-collection-name", "status":"CREATING" } }

See Also

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