ListCollections - Amazon OpenSearch Serverless

ListCollections

Lists all OpenSearch Serverless collections. For more information, see Creating and managing Amazon OpenSearch Serverless collections.

Note

Make sure to include an empty request body {} if you don't include any collection filters in the request.

Request Syntax

{ "collectionFilters": { "name": "string", "status": "string" }, "maxResults": number, "nextToken": "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.

collectionFilters

A list of filter names and values that you can use for requests.

Type: CollectionFilters object

Required: No

maxResults

The maximum number of results to return. Default is 20. You can use nextToken to get the next page of results.

Type: Integer

Valid Range: Minimum value of 1. Maximum value of 100.

Required: No

nextToken

If your initial ListCollections operation returns a nextToken, you can include the returned nextToken in subsequent ListCollections operations, which returns results in the next page.

Type: String

Required: No

Response Syntax

{ "collectionSummaries": [ { "arn": "string", "id": "string", "name": "string", "status": "string" } ], "nextToken": "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.

collectionSummaries

Details about each collection.

Type: Array of CollectionSummary objects

nextToken

When nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page.

Type: String

Errors

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

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

Retrieve all collections

The following example lists all collections.

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.ListCollections {}

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> { "collectionSummaries": [ { "arn": "arn:aws:aoss:us-east-1:123456789012:collection/07tjusf2h91cunochc", "id": "07tjusf2h91cunochc", "name": "collection-1", "status": "ACTIVE" }, { "arn": "arn:aws:aoss:us-east-1:123456789012:collection/63hf8klid6904sfcvb", "id": "63hf8klid6904sfcvb", "name": "collection-2", "status": "FAILED" }, { "arn": "arn:aws:aoss:us-east-1:123456789012:collection/lo0p4fgjs6fbc87ads", "id": "lo0p4fgjs6fbc87ads", "name": "collection-3", "status": "ACTIVE" }, { "arn": "arn:aws:aoss:us-east-1:123456789012:collection/12hd79jbckl6dh4d89", "id": "12hd79jbckl6dh4d89", "name": "collection-4", "status": "DELETING" }, { "arn": "arn:aws:aoss:us-east-1:123456789012:collection/17dg8kiybd96dvnd8s", "id": "17dg8kiybd96dvnd8s", "name": "collection-5", "status": "CREATING" } ], "nextToken": "MWl1NXVzYzQ0b25q" }

Retrieve a subset of collections

The following example lists collections with a status of ACTIVE.

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.ListCollections { "collectionFilters": { "status": "ACTIVE" } }

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> { "collectionSummaries": [ { "arn": "arn:aws:aoss:us-east-1:123456789012:collection/07tjusf2h91cunochc", "id": "07tjusf2h91cunochc", "name": "collection-1", "status": "ACTIVE" }, { "arn": "arn:aws:aoss:us-east-1:123456789012:collection/lo0p4fgjs6fbc87ads", "id": "lo0p4fgjs6fbc87ads", "name": "collection-3", "status": "ACTIVE" } ], "nextToken": "MWl1NXVzYzQ0b25q" }

See Also

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