From 7833b195885d99a22a769885b95a8c6852aa4652 Mon Sep 17 00:00:00 2001 From: keithhc2 Date: Wed, 6 Oct 2021 14:33:08 -0700 Subject: [PATCH] Reorganized index APIs and added delete/get index --- .../rest-api/{ => index-apis}/create-index.md | 5 +- .../rest-api/index-apis/delete-index.md | 45 +++++++++++ _opensearch/rest-api/index-apis/get-index.md | 76 +++++++++++++++++++ _opensearch/rest-api/index-apis/index.md | 16 ++++ _opensearch/rest-api/update-mapping.md | 2 + 5 files changed, 142 insertions(+), 2 deletions(-) rename _opensearch/rest-api/{ => index-apis}/create-index.md (99%) create mode 100644 _opensearch/rest-api/index-apis/delete-index.md create mode 100644 _opensearch/rest-api/index-apis/get-index.md create mode 100644 _opensearch/rest-api/index-apis/index.md diff --git a/_opensearch/rest-api/create-index.md b/_opensearch/rest-api/index-apis/create-index.md similarity index 99% rename from _opensearch/rest-api/create-index.md rename to _opensearch/rest-api/index-apis/create-index.md index 87dc7591..9bae0bcb 100644 --- a/_opensearch/rest-api/create-index.md +++ b/_opensearch/rest-api/index-apis/create-index.md @@ -1,8 +1,9 @@ --- layout: default title: Create index -parent: REST API reference -nav_order: 3 +parent: Index APIs +grand_parent: REST API reference +nav_order: 1 --- # Create index diff --git a/_opensearch/rest-api/index-apis/delete-index.md b/_opensearch/rest-api/index-apis/delete-index.md new file mode 100644 index 00000000..953225e0 --- /dev/null +++ b/_opensearch/rest-api/index-apis/delete-index.md @@ -0,0 +1,45 @@ +--- +layout: default +title: Delete index +parent: Index APIs +grand_parent: REST API reference +nav_order: 5 +--- + +# Delete index +Introduced 1.0 +{: .label .label-purple } + +If you no longer need an index, you can use the delete index API operation to delete it. + +## Example + +```json +DELETE /sample-index +``` + +## Path and HTTP methods + +``` +DELETE / +``` + +## 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), which must be used with open, closed, or both. Default is open. +ignore_unavailable | Boolean | If true, OpenSearch does not include missing or closed indices in the response. +master_timeout | Time | How long to wait for a connection to the master node. Default is `30s`. +timeout | Time | How long to wait for the response to return. Default is `30s`. + + +## Response +```json +{ + "acknowledged": true +} +``` diff --git a/_opensearch/rest-api/index-apis/get-index.md b/_opensearch/rest-api/index-apis/get-index.md new file mode 100644 index 00000000..3716b495 --- /dev/null +++ b/_opensearch/rest-api/index-apis/get-index.md @@ -0,0 +1,76 @@ +--- +layout: default +title: Get index +parent: Index APIs +grand_parent: REST API reference +nav_order: 10 +--- + +# Get index +Introduced 1.0 +{: .label .label-purple } + +You can use the get index API operation to return information about an index. + +## Example + +```json +GET /sample-index +``` + +## Path and HTTP methods + +``` +GET / +``` + +## 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), which must be used with open, closed, or both. 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 include missing or closed indices in the response. +local | Boolean | Whether to return information from only the local node instead of from the master node. Default is false. +master_timeout | Time | How long to wait for a connection to the master node. Default is `30s`. + + +## Response +```json +{ + "sample-index1": { + "aliases": {}, + "mappings": {}, + "settings": { + "index": { + "creation_date": "1633044652108", + "number_of_shards": "2", + "number_of_replicas": "1", + "uuid": "XcXA0aZ5S0aiqx3i1Ce95w", + "version": { + "created": "135217827" + }, + "provided_name": "sample-index1" + } + } + } +} +``` + +## Response body fields + +Field | Description +:--- | :--- +aliases | Any aliases associated with the index. +mappings | Any mappings in the index. +settings | The index's settings +creation_date | The Unix epoch time of when the index was created. +number_of_shards | How many shards the index has. +number_of_replicas | How many replicas the index has. +uuid | The index's uuid. +created | The version of OpenSearch when the index was created. +provided_name | Name of the index. diff --git a/_opensearch/rest-api/index-apis/index.md b/_opensearch/rest-api/index-apis/index.md new file mode 100644 index 00000000..c105615a --- /dev/null +++ b/_opensearch/rest-api/index-apis/index.md @@ -0,0 +1,16 @@ +--- +layout: default +title: Index APIs +parent: REST API reference +has_children: true +nav_order: 3 +redirect_from: + - /opensearch/rest-api/index-apis/ +--- + +# Index APIs + +The index API operations let you interact with indices in your cluster. Using these operations, you can create, delete, close, and complete other index-related operations. + +If you use the security plugin, make sure you have the appropriate permissions. +{: .note } diff --git a/_opensearch/rest-api/update-mapping.md b/_opensearch/rest-api/update-mapping.md index d39fbcb0..9cd9728c 100644 --- a/_opensearch/rest-api/update-mapping.md +++ b/_opensearch/rest-api/update-mapping.md @@ -6,6 +6,8 @@ nav_order: 6 --- # Update mapping +Introduced 1.0 +{: .label .label-purple } If you want to update an index's mappings to add or update field types after index creation, you can do so with the update mapping API operation.