2019-08-29 22:38:48 +08:00
|
|
|
[[indices-add-alias]]
|
2021-05-25 23:52:16 +08:00
|
|
|
=== Create or update alias API
|
2019-08-29 22:38:48 +08:00
|
|
|
++++
|
2021-05-25 23:52:16 +08:00
|
|
|
<titleabbrev>Create or update alias</titleabbrev>
|
2019-08-29 22:38:48 +08:00
|
|
|
++++
|
|
|
|
|
2021-05-25 23:52:16 +08:00
|
|
|
Adds a data stream or index to an <<alias,alias>>.
|
2019-08-29 22:38:48 +08:00
|
|
|
|
2019-09-06 22:55:16 +08:00
|
|
|
[source,console]
|
2019-08-29 22:38:48 +08:00
|
|
|
----
|
2021-06-01 20:45:22 +08:00
|
|
|
PUT my-data-stream/_alias/my-alias
|
2019-08-29 22:38:48 +08:00
|
|
|
----
|
2021-06-01 20:45:22 +08:00
|
|
|
// TEST[setup:my_data_stream]
|
|
|
|
// TEST[teardown:data_stream_cleanup]
|
2019-08-29 22:38:48 +08:00
|
|
|
|
|
|
|
[[add-alias-api-request]]
|
|
|
|
==== {api-request-title}
|
|
|
|
|
2021-06-01 20:45:22 +08:00
|
|
|
`POST <target>/_alias/<alias>`
|
2019-08-29 22:38:48 +08:00
|
|
|
|
2021-06-01 20:45:22 +08:00
|
|
|
`POST <target>/_aliases/<alias>`
|
2019-08-29 22:38:48 +08:00
|
|
|
|
2021-06-01 20:45:22 +08:00
|
|
|
`PUT <target>/_alias/<alias>`
|
2019-08-29 22:38:48 +08:00
|
|
|
|
2021-06-01 20:45:22 +08:00
|
|
|
`PUT <target>/_aliases/<alias>`
|
2019-08-29 22:38:48 +08:00
|
|
|
|
2021-01-28 21:53:10 +08:00
|
|
|
[[add-alias-api-prereqs]]
|
|
|
|
==== {api-prereq-title}
|
|
|
|
|
|
|
|
* If the {es} {security-features} are enabled, you must have the `manage`
|
2021-06-01 20:45:22 +08:00
|
|
|
<<privileges-list-indices,index privilege>> for the alias and its data streams
|
|
|
|
or indices.
|
2019-08-29 22:38:48 +08:00
|
|
|
|
|
|
|
[[add-alias-api-path-params]]
|
|
|
|
==== {api-path-parms-title}
|
|
|
|
|
|
|
|
`<alias>`::
|
2021-06-01 20:45:22 +08:00
|
|
|
(Required, string) Alias to update. If the alias doesn't exist, the request
|
|
|
|
creates it. Index alias names support <<date-math-index-names,date math>>.
|
2019-08-29 22:38:48 +08:00
|
|
|
|
2021-06-01 20:45:22 +08:00
|
|
|
`<target>`::
|
|
|
|
(Required, string) Comma-separated list of data streams or indices to add.
|
|
|
|
Supports wildcards (`*`). Wildcard patterns that match both data streams and
|
|
|
|
indices return an error.
|
2019-08-29 22:38:48 +08:00
|
|
|
|
|
|
|
[[add-alias-api-query-params]]
|
|
|
|
==== {api-query-parms-title}
|
|
|
|
|
2020-06-02 06:55:05 +08:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
|
2019-08-29 22:38:48 +08:00
|
|
|
|
|
|
|
[[add-alias-api-request-body]]
|
|
|
|
==== {api-request-body-title}
|
|
|
|
|
2021-06-01 20:45:22 +08:00
|
|
|
include::aliases.asciidoc[tag=alias-options]
|