Alias

Introduced 1.0

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

  1. POST _aliases
  2. {
  3. "actions": [
  4. {
  5. "add": {
  6. "index": "movies",
  7. "alias": "movies-alias1"
  8. }
  9. },
  10. {
  11. "remove": {
  12. "index": "old-index",
  13. "alias": "old-index-alias"
  14. }
  15. }
  16. ]
  17. }

Path and HTTP methods

  1. POST _aliases

URL parameters

All alias parameters are optional.

ParameterData TypeDescription
master_timeoutTimeThe amount of time to wait for a response from the master node. Default is 30s.
timeoutTimeThe 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.

FieldData TypeDescriptionRequired
actionsArraySet 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
addN/AAdds an alias to the specified index.No
removeN/ARemoves an alias from the specified index.No
remove_indexN/ADeletes an index.No
indexStringName 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.
indicesArrayArray of index names you want to associate with the alias.Yes if you don’t supply an index field in the body.
aliasStringThe name of the alias.Yes if you don’t supply an aliases field in the body.
aliasesArrayArray of alias names.Yes if you don’t supply an alias field in the body.
filterObjectA filter to use with the alias, so the alias points to a filtered part of the index.No
is_hiddenBooleanSpecifies whether the alias should be hidden from results that include wildcard expressionsNo
must_existBooleanSpecifies whether the alias to remove must exist.No
is_write_indexBooleanSpecifies 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 a alias that links to multiple indexes, OpenSearch executes the request only on the write index.No
routingStringUsed to assign a custom value to a shard for specific operations.No
index_routingStringAssigns a custom value to a shard only for index operations.No
search_routingStringAssigns a custom value to a shard only for search operations.No

Response

  1. {
  2. "acknowledged": true
  3. }