Merge pull request #239 from opensearch-project/index-apis

Added exists and close index to REST API
This commit is contained in:
Keith Chan 2021-10-29 13:03:57 -07:00 committed by GitHub
commit 92165b0b08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 98 additions and 2 deletions

View File

@ -0,0 +1,53 @@
---
layout: default
title: Close index
parent: Index APIs
grand_parent: REST API reference
nav_order: 30
---
# Close index
Introduced 1.0
{: .label .label-purple }
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
```json
POST /sample-index/_close
```
## Path and HTTP methods
```
POST /<index-name>/_close
```
## URL parameters
All parameters are optional.
Parameter | Type | Description
:--- | :--- | :---
&lt;index-name&gt; | String | The index to close. Can be a comma-separated list of multiple index names. Use `_all` or * to close all indices.
allow_no_indices | Boolean | Whether to ignore wildcards that don't match any indices. Default is true.
expand_wildcards | String | Expands wildcard expressions to different indices. Combine multiple values with commas. Available values are all (match all indices), open (match open indices), closed (match closed indices), hidden (match hidden indices), and none (do not accept wildcard expressions). Default is open.
ignore_unavailable | Boolean | If true, OpenSearch does not search for missing or closed indices. Default is false.
wait_for_active_shards | String | Specifies 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.
master_timeout | Time | How long to wait for a connection to the master node. Default is `30s`.
timeout | Time | How long to wait for a response from the cluster. Default is `30s`.
## Response
```json
{
"acknowledged": true,
"shards_acknowledged": true,
"indices": {
"sample-index1": {
"closed": true
}
}
}
```

View File

@ -3,7 +3,7 @@ layout: default
title: Delete index
parent: Index APIs
grand_parent: REST API reference
nav_order: 5
nav_order: 10
---
# Delete index

View File

@ -0,0 +1,43 @@
---
layout: default
title: Index exists
parent: Index APIs
grand_parent: REST API reference
nav_order: 5
---
# Index exists
Introduced 1.0
{: .label .label-purple }
The index exists API operation returns whether or not an index already exists.
## Example
```json
HEAD /sample-index
```
## Path and HTTP methods
```
HEAD /<index-name>
```
## URL parameters
All parameters are optional.
Parameter | Type | Description
:--- | :--- | :---
allow_no_indices | Boolean | Whether to ignore wildcards that don't match any indices. Default is true.
expand_wildcards | String | Expands wildcard expressions to different indices. Combine multiple values with commas. Available values are all (match all indices), open (match open indices), closed (match closed indices), hidden (match hidden indices), and none (do not accept wildcard expressions). Default is open.
flat_settings | Boolean | Whether to return settings in the flat form, which can improve readability, especially for heavily nested settings. For example, the flat form of "index": { "creation_date": "123456789" } is "index.creation_date": "123456789".
include_defaults | Boolean | Whether to include default settings as part of the response. This parameter is useful for identifying the names and current values of settings you want to update.
ignore_unavailable | Boolean | If true, OpenSearch does not search for missing or closed indices. Default is false.
local | Boolean | Whether to return information from only the local node instead of from the master node. Default is false.
## Response
The index exists API operation returns only one of two possible response codes: `200` -- the index exists, and `404` -- the index does not exist.

View File

@ -3,7 +3,7 @@ layout: default
title: Get index
parent: Index APIs
grand_parent: REST API reference
nav_order: 10
nav_order: 20
---
# Get index