This version of the OpenSearch documentation is no longer maintained. For the latest version, see the current documentation. For information about OpenSearch version maintenance, see Release Schedule and Maintenance Policy.

Close index

Introduced 1.0

The close index API operation closes an index. Once an index is closed, you cannot add data to it or search for any data within the index.

Example

  1. POST /sample-index/_close

copy

Path and HTTP methods

  1. POST /<index-name>/_close

URL parameters

All parameters are optional.

ParameterTypeDescription
<index-name>StringThe index to close. Can be a comma-separated list of multiple index names. Use _all or * to close all indexes.
allow_no_indicesBooleanWhether to ignore wildcards that don’t match any indexes. Default is true.
expand_wildcardsStringExpands wildcard expressions to different indexes. Combine multiple values with commas. Available values are all (match all indexes), open (match open indexes), closed (match closed indexes), hidden (match hidden indexes), and none (do not accept wildcard expressions). Default is open.
ignore_unavailableBooleanIf true, OpenSearch does not search for missing or closed indexes. Default is false.
wait_for_active_shardsStringSpecifies the number of active shards that must be available before OpenSearch processes the request. Default is 1 (only the primary shard). Set to all or a positive integer. Values greater than 1 require replicas. For example, if you specify a value of 3, the index must have two replicas distributed across two additional nodes for the request to succeed.
cluster_manager_timeoutTimeHow long to wait for a connection to the cluster manager node. Default is 30s.
timeoutTimeHow long to wait for a response from the cluster. Default is 30s.

Response

  1. {
  2. "acknowledged": true,
  3. "shards_acknowledged": true,
  4. "indices": {
  5. "sample-index1": {
  6. "closed": true
  7. }
  8. }
  9. }