Skip to main content

opensearch_indexes

Creates, updates, deletes, gets or lists an opensearch_indexes resource.

Overview

Nameopensearch_indexes
TypeResource
Iddigitalocean.databases.opensearch_indexes

Fields

The following fields are returned by SELECT queries:

A JSON object with a key of indexes.

NameDatatypeDescription
index_namestringThe name of the opensearch index. (example: events)
created_timestring (date-time)The date and time the index was created. (example: 2021-01-01T00:00:00Z)
healthstringThe health of the OpenSearch index. (example: green)
number_of_replicasintegerThe number of replicas for the index.
number_of_shardsintegerThe number of shards for the index.
sizeintegerThe size of the index.
statusstringThe status of the OpenSearch index. (example: open)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
databases_list_opensearch_indexesselectdatabase_cluster_uuidTo list all of a OpenSearch cluster's indexes, send a GET request to
/v2/databases/$DATABASE_ID/indexes.

The result will be a JSON object with a indexes key.
databases_delete_opensearch_indexdeletedatabase_cluster_uuid, index_nameTo delete a single index within OpenSearch cluster, send a DELETE request
to /v2/databases/$DATABASE_ID/indexes/$INDEX_NAME.

A status of 204 will be given. This indicates that the request was
processed successfully, but that no response body is needed.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
database_cluster_uuidstring (uuid)A unique identifier for a database cluster. (example: 9cc10173-e9ea-4176-9dbc-a4cee4c4ff30)
index_namestringThe name of the OpenSearch index. (example: logs-*)

SELECT examples

To list all of a OpenSearch cluster's indexes, send a GET request to
/v2/databases/$DATABASE_ID/indexes.

The result will be a JSON object with a indexes key.

SELECT
index_name,
created_time,
health,
number_of_replicas,
number_of_shards,
size,
status
FROM digitalocean.databases.opensearch_indexes
WHERE database_cluster_uuid = '{{ database_cluster_uuid }}' -- required;

DELETE examples

To delete a single index within OpenSearch cluster, send a DELETE request
to /v2/databases/$DATABASE_ID/indexes/$INDEX_NAME.

A status of 204 will be given. This indicates that the request was
processed successfully, but that no response body is needed.

DELETE FROM digitalocean.databases.opensearch_indexes
WHERE database_cluster_uuid = '{{ database_cluster_uuid }}' --required
AND index_name = '{{ index_name }}' --required;