Documentation Index
Fetch the complete documentation index at: https://upstash.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Aliases let you create alternative names for your search indices. This is useful for zero-downtime reindexing — you can build a new index, then atomically swap the alias to point to it.
Adding an Alias
The SEARCH.ALIASADD command creates a new alias or updates an existing alias to point to a different index.
Returns 1 if a new alias was created, or 2 if an existing alias was updated to point to a new index.
TypeScript
Python
Redis CLI
// Top-level: create or update an alias
const result = await redis.search.alias.add({
indexName: "products-v2",
alias: "products",
});
// Via index method
const result2 = await index.addAlias({ alias: "products" });
# Top-level: create or update an alias
result = redis.search.alias.add(index_name="products-v2", alias="products")
# Via index method
result = index.add_alias(alias="products")
# Create or update an alias
SEARCH.ALIASADD products products-v2
A common pattern is to use aliases for zero-downtime reindexing:
TypeScript
Python
Redis CLI
// 1. Create a new index with updated schema
const productsV2 = await redis.search.createIndex({
name: "products-v2",
dataType: "json",
prefix: "product:",
schema,
});
// 2. Wait for indexing to complete
await productsV2.waitIndexing();
// 3. Swap the alias to point to the new index
await redis.search.alias.add({
indexName: "products-v2",
alias: "products",
});
// 4. Drop the old index
const oldIndex = redis.search.index({ name: "products-v1" });
await oldIndex.drop();
# 1. Create a new index with updated schema
products_v2 = redis.search.create_index(
name="products-v2",
data_type="json",
prefix="product:",
schema=schema,
)
# 2. Wait for indexing to complete
products_v2.wait_indexing()
# 3. Swap the alias to point to the new index
redis.search.alias.add(index_name="products-v2", alias="products")
# 4. Drop the old index
old_index = redis.search.index(name="products-v1")
old_index.drop()
# 1. Create new index
SEARCH.CREATE products-v2 ON JSON PREFIX 1 product: SCHEMA name TEXT price F64 FAST
# 2. Wait for indexing
SEARCH.WAITINDEXING products-v2
# 3. Swap alias
SEARCH.ALIASADD products products-v2
# 4. Drop old index
SEARCH.DROP products-v1
Deleting an Alias
The SEARCH.ALIASDEL command removes an alias.
Returns 1 if the alias was deleted, or 0 if the alias was not found.
TypeScript
Python
Redis CLI
const result = await redis.search.alias.delete({ alias: "products" });
result = redis.search.alias.delete(alias="products")
Listing Aliases
The SEARCH.LISTALIASES command returns all aliases and the indices they point to.
TypeScript
Python
Redis CLI
const aliases = await redis.search.alias.list();
// → { "products": "products-v2", "users": "users-v1" }
aliases = redis.search.alias.list()
# → {"products": "products-v2", "users": "users-v1"}
SEARCH.LISTALIASES
# → [["products", "products-v2"], ["users", "users-v1"]]