Loading

Channels

Channels handle the mechanics of getting your documents into Elasticsearch reliably: buffering, batching into _bulk requests, concurrent export, retries with backoff, and backpressure -- so you can focus on producing documents and let the channel handle delivery.

IngestChannel<T> is the primary channel type. It uses a composable strategy pattern for all behaviors and auto-configures from ElasticsearchTypeContext when available.

var options = new IngestChannelOptions<Product>(transport, MyContext.Product.Context);
using var channel = new IngestChannel<Product>(options);

await channel.BootstrapElasticsearchAsync(BootstrapMethod.Failure);

channel.TryWrite(new Product { Sku = "ABC", Name = "Widget" });
await channel.WaitForDrainAsync(TimeSpan.FromSeconds(30), ctx);
		
  • Channel configuration: options, buffer configuration, strategies, callbacks
  • Legacy channels: migration guide for DataStreamChannel, IndexChannel, CatalogChannel, and semantic channels
  1. Create: instantiate with options (and optional ElasticsearchTypeContext for auto-configuration)
  2. Bootstrap: call BootstrapElasticsearchAsync to create templates and indices
  3. Write: use TryWrite (non-blocking) or WaitToWriteAsync (with backpressure) to buffer documents
  4. Drain: call WaitForDrainAsync to flush all buffered documents
  5. Alias (optional): call ApplyAliasesAsync to swap aliases after indexing
  6. Rollover (optional): call RolloverAsync to trigger manual index rollover
  7. Dispose: the channel implements IDisposable
Method Behavior
TryWrite(doc) Non-blocking. Returns false if buffer is full.
WaitToWriteAsync(doc, ctx) Async with backpressure. Blocks if buffer is full.
TryWriteMany(docs) Non-blocking batch write.
WaitToWriteManyAsync(docs, ctx) Async batch write with backpressure.

See push model for details on buffering, batching, and concurrent export.