-
Notifications
You must be signed in to change notification settings - Fork 507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the documentation of create or update alias API #7641
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
31ee8c6
Add the documentation of create or update alias API
gaobinlong 169f48c
Merge remote-tracking branch 'upstream/main' into put_alias
gaobinlong a503655
Fix typo
gaobinlong 816df4e
Refine the wording
gaobinlong 7b1c88a
Update update-alias.md
Naarcha-AWS 0e72127
Merge remote-tracking branch 'upstream/main' into put_alias
gaobinlong 89ca07e
Fix typo
gaobinlong c31c13f
Merge branch 'main' into put_alias
Naarcha-AWS 398c392
Add some clarification
gaobinlong c77f93f
Update update-alias.md
Naarcha-AWS 448ef0b
Update update-alias.md
Naarcha-AWS 333d988
Apply suggestions from code review
Naarcha-AWS 3d13c84
Update _api-reference/index-apis/update-alias.md
natebower 7f8fefa
Merge branch 'main' into put_alias
Naarcha-AWS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
--- | ||
layout: default | ||
title: Create or Update Alias | ||
parent: Index APIs | ||
nav_order: 5 | ||
--- | ||
|
||
# Create or Update Alias | ||
Check failure on line 8 in _api-reference/index-apis/update-alias.md GitHub Actions / style-job
|
||
**Introduced 1.0** | ||
{: .label .label-purple } | ||
|
||
The Create or Update Alias API adds a data stream or index to an alias or updates the settings for an existing alias. For more alias API operations, see [Index aliases]({{site.url}}{{site.baseurl}}/opensearch/index-alias/). | ||
|
||
The Create or Update Alias API is distinct from the [Alias API]({{site.url}}{{site.baseurl}}/opensearch/rest-api/alias/), which supports the addition and removal of aliases and the removal of alias indexes. In contrast, the following API only supports adding or updating an alias without updating the index itself. Each API also uses different request body parameters. | ||
{: .note} | ||
|
||
## Path and HTTP methods | ||
|
||
``` | ||
POST /<target>/_alias/<alias-name> | ||
PUT /<target>/_alias/<alias-name> | ||
POST /_alias/<alias-name> | ||
PUT /_alias/<alias-name> | ||
POST /<target>/_aliases/<alias-name> | ||
PUT /<target>/_aliases/<alias-name> | ||
POST /_aliases/<alias-name> | ||
PUT /_aliases/<alias-name> | ||
PUT /<target>/_alias | ||
PUT /<target>/_aliases | ||
PUT /_alias | ||
``` | ||
|
||
## Path parameters | ||
|
||
| Parameter | Type | Description | | ||
:--- | :--- | :--- | ||
| `target` | String | A comma-delimited list of data streams and indexes. Wildcard expressions (`*`) are supported. To target all data streams and indexes in a cluster, use `_all` or `*`. Optional. | | ||
| `alias-name` | String | The alias name to be created or updated. Optional. | | ||
|
||
## Query parameters | ||
|
||
All query parameters are optional. | ||
|
||
Parameter | Type | Description | ||
:--- | :--- | :--- | ||
`cluster_manager_timeout` | Time | The amount of time to wait for a response from the cluster manager node. Default is `30s`. | ||
`timeout` | Time | The amount of time to wait for a response from the cluster. Default is `30s`. | ||
|
||
## Request body | ||
|
||
In the request body, you can specify the index name, the alias name, and the settings for the alias. All fields are optional. | ||
|
||
Field | Type | Description | ||
:--- | :--- | :--- | :--- | ||
`index` | String | A comma-delimited list of data streams or indexes that you want to associate with the alias. If this field is set, it will override the index name specified in the URL path. | ||
`alias` | String | The name of the alias. If this field is set, it will override the alias name specified in the URL path. | ||
`is_write_index` | Boolean | Specifies whether the index should be a write index. An alias can only have one write index at a time. If a write request is submitted to an alias that links to multiple indexes, then OpenSearch runs the request only on the write index. | ||
`routing` | String | Assigns a custom value to a shard for specific operations. | ||
`index_routing` | String | Assigns a custom value to a shard only for index operations. | ||
`search_routing` | String | Assigns a custom value to a shard only for search operations. | ||
`filter` | Object | A filter to use with the alias so that the alias points to a filtered part of the index. | ||
|
||
## Example request | ||
|
||
The following example request adds a sample alias with a custom routing value: | ||
|
||
```json | ||
POST sample-index/_alias/sample-alias | ||
{ | ||
"routing":"test" | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
## Example response | ||
|
||
```json | ||
{ | ||
"acknowledged": true | ||
} | ||
``` | ||
|
||
For more alias API operations, see [Index aliases]({{site.url}}{{site.baseurl}}/opensearch/index-alias/). |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
json?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for these. They are meant to be copy and pasted individually depending on what endpoint the user selects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Naarcha-AWS Based on the API template, shouldn't this have highlighting, though? @kolchfa-aws Can you verify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, even though the path and HTTP method are not part of JSON, we still have the json formatting tag on these for consistency.