![]() |
VOOZH | about |
dotnet add package Elastic.Ingest.Elasticsearch --version 0.48.0
NuGet\Install-Package Elastic.Ingest.Elasticsearch -Version 0.48.0
<PackageReference Include="Elastic.Ingest.Elasticsearch" Version="0.48.0" />
<PackageVersion Include="Elastic.Ingest.Elasticsearch" Version="0.48.0" />Directory.Packages.props
<PackageReference Include="Elastic.Ingest.Elasticsearch" />Project file
paket add Elastic.Ingest.Elasticsearch --version 0.48.0
#r "nuget: Elastic.Ingest.Elasticsearch, 0.48.0"
#:package Elastic.Ingest.Elasticsearch@0.48.0
#addin nuget:?package=Elastic.Ingest.Elasticsearch&version=0.48.0Install as a Cake Addin
#tool nuget:?package=Elastic.Ingest.Elasticsearch&version=0.48.0Install as a Cake Tool
Production-ready bulk ingestion into Elasticsearch — batching, backpressure, retries, and index management handled for you.
dotnet add package Elastic.Ingest.Elasticsearch
1. Define a document with mapping attributes:
public class Product
{
[Keyword]
public string Sku { get; set; }
[Text]
public string Name { get; set; }
[Keyword]
public string Category { get; set; }
}
2. Declare a mapping context:
[ElasticsearchMappingContext]
[Index<Product>(Name = "products")]
public static partial class MyContext;
3. Create a channel, bootstrap, and write:
var options = new IngestChannelOptions<Product>(transport, MyContext.Product.Context);
using var channel = new IngestChannel<Product>(options);
await channel.BootstrapElasticsearchAsync(BootstrapMethod.Failure);
foreach (var product in products)
channel.TryWrite(product);
await channel.WaitForDrainAsync(TimeSpan.FromSeconds(10), ctx);
From [Index<Product>] the channel infers: target an index named products, create component and index templates, use index bulk operations, and create a new index on each bootstrap.
When you need more control, use the IngestStrategies and BootstrapStrategies factory methods:
// Data stream with 30-day retention
var strategy = IngestStrategies.DataStream<LogEntry>(context, "30d");
var options = new IngestChannelOptions<LogEntry>(transport, strategy, context);
// Data stream with ILM policy
var strategy = IngestStrategies.DataStream<LogEntry>(context,
BootstrapStrategies.DataStreamWithIlm("logs-policy", hotMaxAge: "7d", deleteMinAge: "90d"));
// Index with ILM policy
var strategy = IngestStrategies.Index<Product>(context,
BootstrapStrategies.IndexWithIlm("products-policy"));
Requires netstandard2.1 / net8.0 or later.
Elasticsearch's coordinating node rejects bulk requests whose body exceeds http.max_content_length (default 100 MB) or indices.breaker.total.limit (~95% of heap). When event sizes vary widely — a 5 MB document alongside a 2 KB one — a count-only batch can blow past these limits, causing 429 rejections that exhaust retries and drop documents.
Set OutboundBufferMaxBytes to cap each request body:
var options = new IngestChannelOptions<MyDoc>(transport, context)
{
BufferOptions = new BufferOptions
{
OutboundBufferMaxSize = 1_000,
OutboundBufferMaxBytes = 100 * 1024 * 1024, // 100 MB
}
};
Count, age, and byte limits are independent — whichever fires first flushes the batch.
Each document is serialized exactly once. When the budget is set, ExportAsync serializes each event once to a local buffer, tracks the running byte total, and issues a new _bulk HTTP request whenever the total would exceed the limit. A single outbound page may become N sub-requests; their responses are merged transparently before the retry loop sees them. There is no double-serialize, no background measurement pass, and no per-event byte array retained in memory.
Memory during export: a local MemoryStream accumulates one sub-request body at a time (≤ OutboundBufferMaxBytes). It is freed when the export call returns. Peak = MaxConcurrency × OutboundBufferMaxBytes.
Oversized individual events (a single document larger than the budget) are always emitted in their own sub-request. The ItemExceedsBytesBudgetCallback fires as a warning:
var options = new IngestChannelOptions<MyDoc>(transport, context)
{
BufferOptions = new BufferOptions { OutboundBufferMaxBytes = 100 * 1024 * 1024 },
ItemExceedsBytesBudgetCallback = (doc, bytes) =>
logger.LogWarning("Document {Id} is {Bytes:N0} bytes, exceeds batch budget", doc.Id, bytes),
};
Beyond channel-based bulk ingest, the library provides helper APIs for common Elasticsearch operations.
All helpers accept an ITransport instance and yield IAsyncEnumerable streams for progress monitoring.
PointInTimeSearch<T> — iterate all documents in an index using PIT with search_after paginationServerReindex — start a server-side _reindex and poll until completionDeleteByQuery — start a _delete_by_query and poll until completionClientReindex<T> — read from a source index via PIT search and write to a destination IngestChannel// Example: PIT search
var search = new PointInTimeSearch<MyDoc>(transport, new() { Index = "my-index" });
await foreach (var page in search.SearchPagesAsync())
Console.WriteLine($"Got {page.Documents.Count} docs");
// Example: Server reindex
var reindex = new ServerReindex(transport, new() { Source = "old", Destination = "new" });
await foreach (var progress in reindex.MonitorAsync())
Console.WriteLine($"{progress.FractionComplete:P0}");
Full documentation: https://elastic.github.io/elastic-ingest-dotnet/
DataStreamChannel<> and IndexChannel<> still exist for backward compatibility but IngestChannel<T> with composable strategies is the recommended API for all new code.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 2 NuGet packages that depend on Elastic.Ingest.Elasticsearch:
| Package | Downloads |
|---|---|
|
Elastic.Ingest.Elasticsearch.CommonSchema
Package Description |
|
|
Raycynix.Extensions.Logging.Elastic
Elasticsearch sink integration for Raycynix Serilog-based logging. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.48.0 | 367 | 6/3/2026 |
| 0.47.0 | 114 | 6/3/2026 |
| 0.46.0 | 272 | 6/2/2026 |
| 0.45.0 | 2,184 | 5/12/2026 |
| 0.44.1 | 508 | 5/12/2026 |
| 0.44.0 | 210 | 5/11/2026 |
| 0.43.0 | 975 | 4/20/2026 |
| 0.42.0 | 306 | 4/20/2026 |
| 0.41.2 | 16,783 | 4/15/2026 |
| 0.41.1 | 457 | 4/15/2026 |
| 0.41.0 | 1,097 | 3/31/2026 |
| 0.40.0 | 3,726 | 3/21/2026 |
| 0.39.0 | 366 | 3/20/2026 |
| 0.38.0 | 368 | 3/20/2026 |
| 0.37.0 | 1,668 | 3/5/2026 |
| 0.36.0 | 346 | 3/5/2026 |
| 0.35.0 | 351 | 3/5/2026 |
| 0.34.5 | 8,577 | 3/3/2026 |
| 0.34.4 | 342 | 3/3/2026 |
| 0.34.3 | 356 | 3/3/2026 |