Performs one or more alias actions in a single atomic operation.
POST _aliases
{
"actions": [
{
"add": {
"index": "my-data-stream",
"alias": "my-alias"
}
}
]
}
-
If the Elasticsearch security features are enabled, you must have the following index privileges:
-
To use the
addorremoveaction, you must have themanageindex privilege for the alias and its data streams or indices. -
To use the
remove_indexaction, you must have themanageindex privilege for the index.
-
To use the
-
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.
-
actions -
(Required, array of objects) Actions to perform.
Properties of
actionsobjects-
<action> -
(Required, object) The key is the action type. At least one action is required.
Valid
<action>keys-
add -
Adds a data stream or index to an alias. If the alias doesn’t exist, the
addaction creates it. -
remove - Removes a data stream or index from an alias.
-
remove_index - Deletes an index. You cannot use this action on aliases or data streams.
The object body contains options for the alias. Supports an empty object.
Properties of
<action>-
alias -
(Required*, string) Alias for the action. Index alias names support
date math. If
aliasesis not specified, theaddandremoveactions require this parameter. For theremoveaction, this parameter supports wildcards (*). Theremove_indexaction doesn’t support this parameter. -
aliases -
(Required*, array of strings) Aliases for the action. Index alias names support
date math. If
aliasis not specified, theaddandremoveactions require this parameter. For theremoveaction, this parameter supports wildcards (*). Theremove_indexaction doesn’t support this parameter.
-
filter -
(Optional, Query DSL object Query used to limit documents the alias can access.
Only the
addaction supports this parameter. -
index -
(Required*, string) Data stream or index for the action. Supports wildcards
(
*). Ifindicesis not specified, this parameter is required. For theaddandremove_indexactions, wildcard patterns that match both data streams and indices return an error. -
indices -
(Required*, array of strings) Data streams or indices for the action. Supports
wildcards (
*). Ifindexis not specified, this parameter is required. For theaddandremove_indexactions, wildcard patterns that match both data streams and indices return an error.
-
index_routing -
(Optional, string) Value used to route indexing operations to a specific shard. If specified, this overwrites the
routingvalue for indexing operations. Data stream aliases don’t support this parameter.Only the
addaction supports this parameter.
-
is_hidden -
(Optional, Boolean) If
true, the alias is hidden. Defaults tofalse. All data streams or indices for the alias must have the sameis_hiddenvalue.Only the
addaction supports this parameter.
-
is_write_index -
(Optional, Boolean) If
true, sets the write index or data stream for the alias.If an alias points to multiple indices or data streams and
is_write_indexisn’t set, the alias rejects write requests. If an index alias points to one index andis_write_indexisn’t set, the index automatically acts as the write index. Data stream aliases don’t automatically set a write data stream, even if the alias points to one data stream.Only the
addaction supports this parameter. -
must_exist -
(Optional, Boolean)
If
true, the alias must exist to perform the action. Defaults tofalse. Only theremoveaction supports this parameter.
-
routing -
(Optional, string) Value used to route indexing and search operations to a specific shard. Data stream aliases don’t support this parameter.
Only the
addaction supports this parameter.
-
search_routing -
(Optional, string) Value used to route search operations to a specific shard. If specified, this overwrites the
routingvalue for search operations. Data stream aliases don’t support this parameter.Only the
addaction supports this parameter.
-
-