Create or update alias APIedit

Adds a data stream or index to an alias.

PUT my-data-stream/_alias/my-alias

Requestedit

POST <target>/_alias/<alias>

POST <target>/_aliases/<alias>

PUT <target>/_alias/<alias>

PUT <target>/_aliases/<alias>

Prerequisitesedit

  • If the Elasticsearch security features are enabled, you must have the manage index privilege for the alias and its data streams or indices.

Path parametersedit

<alias>
(Required, string) Alias to update. If the alias doesn’t exist, the request creates it. Index alias names support date math.
<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.

Query parametersedit

master_timeout
(Optional, time units) Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s.
timeout
(Optional, time units) Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s.

Request bodyedit

filter
(Optional, Query DSL object Query used to limit documents the alias can access.
index_routing
(Optional, string) Value used to route indexing operations to a specific shard. If specified, this overwrites the routing value for indexing operations. Data stream aliases don’t support this parameter.
is_hidden
(Optional, Boolean) If true, the alias is hidden. Defaults to false. All data streams or indices for the alias must have the same is_hidden value.
is_write_index
(Optional, Boolean) If true, sets the write index or data stream for the alias. Defaults to false.
routing
(Optional, string) Value used to route indexing and search operations to a specific shard. Data stream aliases don’t support this parameter.
search_routing
(Optional, string) Value used to route search operations to a specific shard. If specified, this overwrites the routing value for search operations. Data stream aliases don’t support this parameter.