Elastic.Ingest.Elasticsearch
0.11.3
Prefix Reserved
dotnet add package Elastic.Ingest.Elasticsearch --version 0.11.3
NuGet\Install-Package Elastic.Ingest.Elasticsearch -Version 0.11.3
<PackageReference Include="Elastic.Ingest.Elasticsearch" Version="0.11.3" />
<PackageVersion Include="Elastic.Ingest.Elasticsearch" Version="0.11.3" />
<PackageReference Include="Elastic.Ingest.Elasticsearch" />
paket add Elastic.Ingest.Elasticsearch --version 0.11.3
#r "nuget: Elastic.Ingest.Elasticsearch, 0.11.3"
#addin nuget:?package=Elastic.Ingest.Elasticsearch&version=0.11.3
#tool nuget:?package=Elastic.Ingest.Elasticsearch&version=0.11.3
Elastic.Ingest.Elasticsearch
Elastic.Channels
implementations of BufferedChannelBase
that allows data to pushed to either indices or data streams
DataStreamChannel<TEvent>
A channel that specializes to writing data with a timestamp to Elasticsearch data streams. E.g given the following document.
public class TimeSeriesDocument
{
[JsonPropertyName("@timestamp")]
public DateTimeOffset Timestamp { get; set; }
[JsonPropertyName("message")]
public string Message { get; set; }
}
A channel can be created to push data to the logs-dotnet-default
data stream.
var dataStream = new DataStreamName("logs", "dotnet");
var bufferOptions = new BufferOptions { }
var options = new DataStreamChannelOptions<TimeSeriesDocument>(transport)
{
DataStream = dataStream,
BufferOptions = bufferOptions
};
var channel = new DataStreamChannel<TimeSeriesDocument>(options);
NOTE: read more about Elastic's data stream naming convention here: https://www.elastic.co/blog/an-introduction-to-the-elastic-data-stream-naming-scheme
we can now push data to Elasticsearch using the DataStreamChannel
var doc = new TimeSeriesDocument
{
Timestamp = DateTimeOffset.Now,
Message = "Hello World!",
}
channel.TryWrite(doc);
Bootstrap target data stream
Optionally the target data stream can be bootstrapped using the following.
await channel.BootstrapElasticsearchAsync(BootstrapMethod.Failure, "7-days-default");
This will try and set up the target data stream with the 7-days-default
ILM policy.
Throwing exceptions if it fails to do so because BootstrapMethod.Failure
was provided
An index template with accompanying component templates will be created based on the type and dataset portion of the target datastream.
IndexChannel<TEvent>
A channel that specializes in writing catalog data to Elastic indices. Catalog data is typically data that has an id of sorts.
Given the following minimal document
public class CatalogDocument
{
[JsonPropertyName("id")]
public string Id { get; set; }
[JsonPropertyName("title")]
public string Title { get; set; }
[JsonPropertyName("created")]
public DateTimeOffset Created { get; set; }
}
We can create an IndexChannel<>
to push CatalogDocument
instances.
var options = new IndexChannelOptions<CatalogDocument>(transport)
{
IndexFormat = "catalog-data-{0:yyyy.MM.dd}",
BulkOperationIdLookup = c => c.Id,
TimestampLookup = c => c.Created,
};
var channel = new IndexChannel<CatalogDocument>(options);
now we can push data using:
var doc = new CatalogDocument
{
Created = date,
Title = "Hello World!",
Id = "hello-world"
}
channel.TryWrite(doc);
This will push data to catalog-data-2023.01.1
because TimestampLookup
yields Created
to IndexFormat
.
IndexFormat
can also simply be a fixed string to write to an Elasticsearch alias/index.
BulkOperationIdLookup
determines if the document should be pushed to Elasticsearch using a create
or index
operation.
Bootstrap target index
Optionally the target index can be bootstrapped using the following.
await channel.BootstrapElasticsearchAsync(BootstrapMethod.Failure, "7-days-default");
This will try and set up the target data stream with the 7-days-default
ILM policy.
Throwing exceptions if it fails to do so because BootstrapMethod.Failure
was provided
An index template with accompanying component templates will be created based named using IndexFormat
.
CatalogChannel<TDocument>
(experimental)
Where IndexChannel<>
and DataStreamChannel<>
are build for time-series
use-cases CatalogChannel<TDocument>
is build
for cases where we expect to write all data to a single index during the limited lifetime of the application.
It inherits IndexChannel<>
and therefor equally ensures index and component templates get registered.
var options = new CatalogIndexChannelOptions<MyDocument>(transport)
{
SerializerContext = ExampleJsonSerializerContext.Default,
GetMapping = () => // language=json
$$"""
{
"properties": {
"message": {
"type": "text"
}
}
}
"""
};
var c = new CatalogIndexChannel<MyDocument>(options);
await c.BootstrapElasticsearchAsync(BootstrapMethod.Failure);
This will by default write all documents to mydocument-{DateTimeOffset.UtcNow:yyyy.MM.dd.HHmmss}
where the DateTimeOffset.UtcNow
gets queried only once during the channel's instantiation.
You can wait for documents to be indexed and refresh elasticsearch at your expected termination point.
await c.WaitForDrainAsync();
await c.RefreshAsync();
After which you can use you apply the following aliases:
mydocument-latest
the last written indexmydocument
the active search alias
await c.ApplyAliasesAsync();
You can also do this separately:
await c.ApplyLatestAliasAsync();
// Call this later to swap search alias over over to the latest index
await c.ApplyActiveSearchAliasAsync();
SemanticIndexChannel<TDocument>
(experimental)
A specialization of CatalogIndexChannel<TDocument>
var options = new SemanticIndexChannelOptions<MyDocument>(transport)
{
BufferOptions = bufferOptions,
CancellationToken = cancellationTokenSource.Token,
SerializerContext = ExampleJsonSerializerContext.Default,
InferenceCreateTimeout = TimeSpan.FromMinutes(5),
GetMapping = (inferenceId, searchInferenceId) => // language=json
$$"""
{
"properties": {
"message": {
"type": "text",
"fields": {
"semantic": {
"type": "semantic_text",
"inference_id": "{{inferenceId}}"
}
}
}
}
}
"""
};
var c = new SemanticIndexChannel<MyDocument>(options);
The bootstrapping of which by default ensures that inference endpoints using default Elastic-built LLM providers are registered.
However, external inference identifiers can be provided as well.
var options = new SemanticIndexChannelOptions<MyDocument>(transport)
{
UsePreexistingInferenceIds = true
InferenceId = "my-inference-id",
SearchInferenceId = "my-search-inference-id"
};
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Elastic.Ingest.Transport (>= 0.11.3)
-
.NETStandard 2.1
- Elastic.Ingest.Transport (>= 0.11.3)
-
net8.0
- Elastic.Ingest.Transport (>= 0.11.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Elastic.Ingest.Elasticsearch:
Package | Downloads |
---|---|
Elastic.Ingest.Elasticsearch.CommonSchema
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.11.3 | 885 | 5/29/2025 |
0.11.2 | 189 | 5/28/2025 |
0.11.1 | 181 | 5/27/2025 |
0.11.0 | 176 | 5/27/2025 |
0.10.0 | 12,970 | 5/22/2025 |
0.9.0 | 302 | 5/20/2025 |
0.8.0 | 8,611 | 2/12/2025 |
0.7.5 | 798,109 | 11/25/2024 |
0.7.4 | 132 | 11/25/2024 |
0.7.3 | 10,851 | 10/3/2024 |
0.7.2 | 414,924 | 9/18/2024 |
0.7.1 | 298 | 9/16/2024 |
0.7.0 | 901,533 | 4/10/2024 |
0.6.0 | 246 | 3/28/2024 |
0.5.7 | 29,817 | 2/13/2024 |
0.5.6 | 532 | 1/22/2024 |
0.5.5 | 766,817 | 7/12/2023 |
0.5.4 | 200 | 7/10/2023 |
0.5.3 | 233 | 7/5/2023 |
0.5.2 | 246 | 6/22/2023 |
0.5.1 | 220 | 5/4/2023 |
0.5.0 | 118,960 | 4/28/2023 |
0.4.3 | 252 | 4/17/2023 |
0.4.2 | 412 | 4/5/2023 |
0.4.1 | 222 | 4/5/2023 |
0.4.0 | 237 | 4/5/2023 |
0.3.2 | 24,665 | 2/27/2023 |
0.3.1 | 742 | 2/20/2023 |
0.3.0 | 343 | 2/16/2023 |
0.2.2 | 531 | 1/31/2023 |
0.2.1 | 342 | 1/31/2023 |
0.2.0 | 344 | 1/31/2023 |
0.1.0 | 549 | 1/25/2023 |