Create or update an alias Generally available; Added in 1.3.0

POST /_aliases

Adds a data stream or index to an alias.

Query parameters

  • master_timeout string

    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.

    Values are -1 or 0.

  • timeout string

    Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

    Values are -1 or 0.

application/json

Body Required

  • actions array[object]

    Actions to perform.

    Hide actions attributes Show actions attributes object
    • add object
      Hide add attributes Show add attributes object
      • alias string
      • aliases string | array[string]

        Aliases for the action. Index alias names support date math.

      • filter object

        An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.

        External documentation
      • index string
      • indices string | array[string]
      • index_routing string
      • is_hidden boolean

        If true, the alias is hidden.

      • is_write_index boolean

        If true, sets the write index or data stream for the alias.

      • routing string
      • search_routing string
      • must_exist boolean

        If true, the alias must exist to perform the action.

    • remove object
      Hide remove attributes Show remove attributes object
      • alias string
      • aliases string | array[string]

        Aliases for the action. Index alias names support date math.

      • index string
      • indices string | array[string]
      • must_exist boolean

        If true, the alias must exist to perform the action.

    • remove_index object
      Hide remove_index attributes Show remove_index attributes object
      • index string
      • indices string | array[string]
      • must_exist boolean

        If true, the alias must exist to perform the action.

Responses

  • 200 application/json
    Hide response attribute Show response attribute object
    • acknowledged boolean Required

      For a successful response, this value is always true. On failure, an exception is returned instead.

POST /_aliases
curl \
 --request POST 'http://api.example.com/_aliases' \
 --header "Authorization: $API_KEY" \
 --header "Content-Type: application/json" \
 --data '"{\n  \"actions\": [\n    {\n      \"add\": {\n        \"index\": \"logs-nginx.access-prod\",\n        \"alias\": \"logs\"\n      }\n    }\n  ]\n}"'
Request example
An example body for a `POST _aliases` request.
{
  "actions": [
    {
      "add": {
        "index": "logs-nginx.access-prod",
        "alias": "logs"
      }
    }
  ]
}