Loading

Manual alias management

Manual alias management gives you full control over when indices rotate. You create time-stamped indices, write to them, and swap aliases after indexing completes. This is the approach used by IncrementalSyncOrchestrator and the catalog data pattern.

  1. A new index is created with a time-stamped name (for example, products-2026.02.15.120000)
  2. Documents are written to the new index
  3. After drain and refresh, the write alias (products) is swapped to point to the new index
  4. The search alias (products-search) is updated to include the new index
  5. Old indices are optionally cleaned up

Configure aliases in the index declaration:

[Index<Product>(
    Name = "products",
    WriteAlias = "products",
    ReadAlias = "products-search",
    DatePattern = "yyyy.MM.dd.HHmmss"
)]
		
Property Purpose
WriteAlias Alias that points to the current write target
ReadAlias Alias for search queries (can span multiple indices)
DatePattern Suffix pattern for time-stamped index names. Auto-derives search pattern as "{writeTarget}-*"

When WriteAlias and ReadAlias are set, the channel automatically uses LatestAndSearchAliasStrategy. This strategy:

  • Creates (or updates) the write alias to point to the newest index
  • Creates (or updates) the search alias to include all matching indices
  • Uses _aliases API for atomic alias operations

After writing and draining, apply aliases explicitly:

await channel.WaitForDrainAsync(TimeSpan.FromSeconds(30), ctx);
await channel.ApplyAliasesAsync(string.Empty, ctx);
		

Or use IncrementalSyncOrchestrator, which calls CompleteAsync to handle drain, refresh, and alias swapping together.