Skip to main content

Aliases API

Aliases let clients address a collection by a stable name that can be moved to a different target collection later. This is useful for zero-downtime reindexing, versioned collections, and tenant-specific views.

Routes

MethodEndpointPurpose
GET/aliasesList all aliases
GET/collections/{collection}/aliasesList aliases that target a collection
POST/PUT/aliases/{alias}Create or update an alias
GET/aliases/{alias}Get one alias
DELETE/aliases/{alias}Delete an alias

List Aliases

curl http://localhost:9200/aliases

Example response:

{
"aliases": [
{
"name": "products_live",
"collection_name": "products_v2"
}
]
}

List Aliases for a Collection

curl http://localhost:9200/collections/products_v2/aliases

The same filtering can also be requested with the collection query parameter:

curl "http://localhost:9200/aliases?collection=products_v2"

Create or Update Alias

Endpoint: POST /aliases/{alias} or PUT /aliases/{alias}

Request body accepts collection_name or collection:

curl -X PUT http://localhost:9200/aliases/products_live \
-H "Content-Type: application/json" \
-d '{"collection_name":"products_v2"}'

Alternative body:

{
"collection": "products_v2"
}

The target collection must already exist.

Get Alias

curl http://localhost:9200/aliases/products_live

Delete Alias

curl -X DELETE http://localhost:9200/aliases/products_live

Reindexing Pattern

  1. Create products_v2 with the new schema.
  2. Import or backfill documents into products_v2.
  3. Validate searches against products_v2.
  4. Move the alias:
curl -X PUT http://localhost:9200/aliases/products_live \
-H "Content-Type: application/json" \
-d '{"collection_name":"products_v2"}'
  1. Delete the old collection after consumers have moved past it.