From 40c6f07871659e16396aca0b091a652200310333 Mon Sep 17 00:00:00 2001 From: keithhc2 Date: Fri, 25 Jun 2021 11:43:33 -0700 Subject: [PATCH 1/3] Added create alias to API reference page --- _opensearch/rest-api/create-alias.md | 66 ++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 _opensearch/rest-api/create-alias.md diff --git a/_opensearch/rest-api/create-alias.md b/_opensearch/rest-api/create-alias.md new file mode 100644 index 00000000..a255f921 --- /dev/null +++ b/_opensearch/rest-api/create-alias.md @@ -0,0 +1,66 @@ +--- +layout: default +title: Create alias +parent: REST API reference +grand_parent: OpenSearch +nav_order: 8 +--- + +# Create alias + +An alias is a virtual pointer that you can use to reference one or more indices. For example, if you have continuous streams of incoming data but only want to search through the past seven days at any time, you can use an alias to point to only indices created within the past seven days. + +## Example + +```json +POST _aliases +{ + "actions": [ + { + "add": { + "index": "movies", + "alias": "movies-alias1" + } + } + ] +} +``` + +## URL parameters + +Both create alias parameters are optional. + +Parameter | Data Type | Description +:--- | :--- | :--- +master_timeout | Time | The amount of time to wait for a response from the master node. Default is `30s`. +timeout | Time | The amount of time to wait for a response from the cluster. Default is `30s`. + +## Request body + +In your request body, you need to specify what action to take, the alias name, and the index you want to associate with the alias. Other fields are optional. + +Field | Data Type | Description | Required +:--- | :--- | :--- | :--- +actions | Array | Set of actions you want to perform on the index. Valid options are: `add`, `remove`, and `remove_index`. You must have at least one action in the array. | Yes +add | N/A | Adds an alias to the specified index. | No +remove | N/A | Removes an alias from the specified index. | No +remove_index | N/A | Deletes an index. | No +index | String | Name of the index you want to associate with the alias. Supports wildcard expressions. | Yes if you don't supply an `indices` field in the body. +indices | Array | Array of index names you want to associate with the alias. | Yes if you don't supply an `index` field in the body. +alias | String | The name of the alias. | Yes if you don't supply an `aliases` field in the body. +aliases | Array | Array of alias names. | Yes if you don't supply an `alias` field in the body. +filter | Object | A filter to use with the alias, so the alias points to a filtered part of the index. | No +is_hidden | Boolean | Specifies whether the alias should be hidden from results that include wildcard expressions | No +must_exist | Boolean | Specifies whether the alias to remove must exist. | No +is_write_index | Boolean | Specifies whether the index should be a write index. An alias can only have one write index at a time. | No +routing | String | Used to assign a custom value to a shard for specific operations. | No +index_routing | String | Assigns a custom value to a shard only for index operations. | No +search_routing | String | Assigns a custom value to a shard only for search operations. | No + +## Response + +```json +{ + "acknowledged": true +} +``` From 13f7a847c1929e50a39c02a0a00d2546087f80a5 Mon Sep 17 00:00:00 2001 From: keithhc2 Date: Mon, 28 Jun 2021 10:36:41 -0700 Subject: [PATCH 2/3] Addressed some comments. --- _opensearch/rest-api/create-alias.md | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/_opensearch/rest-api/create-alias.md b/_opensearch/rest-api/create-alias.md index a255f921..bca73403 100644 --- a/_opensearch/rest-api/create-alias.md +++ b/_opensearch/rest-api/create-alias.md @@ -1,14 +1,15 @@ --- layout: default -title: Create alias +title: Alias parent: REST API reference grand_parent: OpenSearch nav_order: 8 --- -# Create alias +# Alias + +An alias is a virtual pointer that you can use to reference one or more indices. -An alias is a virtual pointer that you can use to reference one or more indices. For example, if you have continuous streams of incoming data but only want to search through the past seven days at any time, you can use an alias to point to only indices created within the past seven days. ## Example @@ -21,14 +22,27 @@ POST _aliases "index": "movies", "alias": "movies-alias1" } + }, + { + "remove": { + "index": "old-index", + "alias": "old-index-alias" + } } + ] } ``` +## Path and HTTP Methods + +``` +POST _aliases +``` + ## URL parameters -Both create alias parameters are optional. +All alias parameters are optional. Parameter | Data Type | Description :--- | :--- | :--- From 268a85ba0ccb261a4355b3957fdab9cdf024b811 Mon Sep 17 00:00:00 2001 From: keithhc2 Date: Mon, 28 Jun 2021 16:08:28 -0700 Subject: [PATCH 3/3] Added a little more to the intro --- _opensearch/rest-api/create-alias.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_opensearch/rest-api/create-alias.md b/_opensearch/rest-api/create-alias.md index bca73403..7b0f786e 100644 --- a/_opensearch/rest-api/create-alias.md +++ b/_opensearch/rest-api/create-alias.md @@ -8,7 +8,7 @@ nav_order: 8 # Alias -An alias is a virtual pointer that you can use to reference one or more indices. +An alias is a virtual pointer that you can use to reference one or more indices. Creating and updating aliases are atomic operations, so you can reindex your data and point an alias at it without any downtime. ## Example