NAME
Typesense::Client::Aliases - collection aliases, for reindexing without downtime
SYNOPSIS
# Build the new index under a fresh, timestamped name...
my $new = 'products_' . $stamp;
$ts->collections->create({ name => $new, fields => [...] });
$ts->documents->import_docs($new, \@docs);
# ...check it before anyone searches it...
die 'short index' if $ts->collections->get($new)->{num_documents} < $expected;
# ...and swap in one atomic call.
$ts->aliases->set('products', $new);
$ts->collections->drop($old);
DESCRIPTION
An alias is a name that points at a collection. Searching the alias searches whatever it currently points to, so pointing it somewhere else swaps an entire index atomically, with no window where the site has no results.
This is the reason to always search an alias and never a collection directly.
METHODS
list
GET /aliases.
get
GET /aliases/{alias}. Returns the alias and its collection_name.
set
PUT /aliases/{alias}. Creates or repoints. Atomic.
delete
DELETE /aliases/{alias}. An alias that does not exist is not an error.
SEE ALSO
AUTHOR
SeHarrys
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by SeHarrys.
This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.