Elastic.Ingest.Elasticsearch.CommonSchema 8.12.2

Prefix Reserved
dotnet add package Elastic.Ingest.Elasticsearch.CommonSchema --version 8.12.2                
NuGet\Install-Package Elastic.Ingest.Elasticsearch.CommonSchema -Version 8.12.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Elastic.Ingest.Elasticsearch.CommonSchema" Version="8.12.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Elastic.Ingest.Elasticsearch.CommonSchema --version 8.12.2                
#r "nuget: Elastic.Ingest.Elasticsearch.CommonSchema, 8.12.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Elastic.Ingest.Elasticsearch.CommonSchema as a Cake Addin
#addin nuget:?package=Elastic.Ingest.Elasticsearch.CommonSchema&version=8.12.2

// Install Elastic.Ingest.Elasticsearch.CommonSchema as a Cake Tool
#tool nuget:?package=Elastic.Ingest.Elasticsearch.CommonSchema&version=8.12.2                

Elastic.Ingest.Elasticsearch.CommonSchema

A specialization of Elastic.Ingest.Elasticsearch that offers two channel implementations that make it easy to write ECS formatted data and bootstrap the target datastreams/indices with ECS mappings and settings.

EcsDataStreamChannel<TEvent>

A channel that specializes to writing data with a timestamp to Elasticsearch data streams.

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<EcsDocument>(transport)
{
  DataStream = dataStream,
  BufferOptions = bufferOptions
};
var channel = new EcsDataStreamChannel<EcsDocument>(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 EcsDataStreamChannel

var doc = new EcsDocument 
{ 
    Timestamp = DateTimeOffset.Now, 
    Message = "Hello World!", 
}
channel.TryWrite(doc);

EcsIndexChannel<TEvent>

A channel that specializes in writing catalog data to Elastic indices.

We can create an EcsIndexChannel<> to push EcsDocument (or subclassed) instances.

var options = new IndexChannelOptions<EcsDocument>(transport)
{
    IndexFormat = "catalog-data-{0:yyyy.MM.dd}",
    // BulkOperationIdLookup = c => null,
    TimestampLookup = c => c.Timestamp,
};
var channel = new EcsIndexChannel<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 Timestamp 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.

Bootstrapping target Datastream or Index

Optionally the target data stream or index can be bootstrapped using the following.

await channel.BootstrapElasticsearchAsync(BootstrapMethod.Failure, "7-days-default"); 

This will bootstrap:

If the index template already exists no further bootstrapping will occur.

Just like Elastic.Ingest.Elasticsearch the channel is aware that logs and metrics have default component templates and ensures the new index tempate references them.

Product 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 was computed.  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. 
.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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on Elastic.Ingest.Elasticsearch.CommonSchema:

Package Downloads
Elastic.Serilog.Sinks

Package Description

Elastic.CommonSchema.BenchmarkDotNetExporter

Exports BenchmarkDotNet benchmarks to Elasticsearch using Elastic Common Schema (ECS) format

Elastic.Extensions.Logging

Elasticsearch logger provider for Microsoft.Extensions.Logging. Writes direct to Elasticsearch using the Elastic Common Schema (ECS), with semantic logging of structured data from message and scope values, for use with the Elasticsearch-Logstash-Kibana (ELK) stack. The results can be viewed and queried in the Kibana console.

Elasticsearch.Extensions.Logging

Elasticsearch logger provider for Microsoft.Extensions.Logging. Writes direct to Elasticsearch using the Elastic Common Schema (ECS), with semantic logging of structured data from message and scope values, for use with the Elasticsearch-Logstash-Kibana (ELK) stack. The results can be viewed and queried in the Kibana console.

Elastic.NLog.Targets

NLog Target that exports directly to Elastic Cloud or individual Elasticsearch nodes

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.12.2 51,177 10/22/2024
8.12.1 48,312 10/3/2024
8.12.0 19,439 9/26/2024
8.11.1 313,672 6/10/2024
8.11.0 117,362 4/10/2024
8.6.1 577,974 8/3/2023
8.6.0 100,649 5/9/2023
8.4.0-alpha4 21,796 3/28/2023
8.4.0-alpha3 377 3/15/2023
8.4.0-alpha2 637 3/1/2023
8.4.0-alpha1 577 2/20/2023