ElasticSync.NET
2.0.0
dotnet add package ElasticSync.NET --version 2.0.0
NuGet\Install-Package ElasticSync.NET -Version 2.0.0
<PackageReference Include="ElasticSync.NET" Version="2.0.0" />
<PackageVersion Include="ElasticSync.NET" Version="2.0.0" />
<PackageReference Include="ElasticSync.NET" />
paket add ElasticSync.NET --version 2.0.0
#r "nuget: ElasticSync.NET, 2.0.0"
#:package ElasticSync.NET@2.0.0
#addin nuget:?package=ElasticSync.NET&version=2.0.0
#tool nuget:?package=ElasticSync.NET&version=2.0.0
ElasticSync.NET.PostgreSql is a high-performance .NET library that synchronizes PostgreSQL data to Elasticsearch in real-time with built-in reliability, scalability, and monitoring.
It’s designed for the teams that want instant search indexing without building and maintaining complex change-tracking pipelines or withouth the need of any additional server/tools like Debzium, Kafka etc
✨ Features
- Real-time sync from PostgreSQL to Elasticsearch index
- Interval-based syncing with configurable intervals
- Parallel work Configurable parallel processing supported for high volume data changes.
- Multiple entity type support (e.g., Products, Orders, Customers)
- Automatic trigger & change tracking in PostgreSQL
- Retry logic for transient errors
- Bulk indexing for performance optimization
- Highly Configurable Easy to use and configure without hosting/installing any additional data syncing tools/server
🚀 Getting Started
1. Install the NuGet Package
dotnet add package ElasticSync.NET.PostgreSql
1. Basic Usages
1.1 Use Real-Time Sync
builder.Services.AddElasticSyncEngine(options =>
{
options.ElasticsearchUrl = builder.Configuration["Elasticsearch:Uri"];
options.RealTimeSync();
options.MaxRetries = 5;
options.RetryDelayInSeconds = 20;
options.Entities = new List<TrackedEntity>
{
new TrackedEntity { Table = "Customers", EntityType = typeof(Customer), PrimaryKey = "Id", IndexName = "customers"},
new TrackedEntity { Table = "Products", EntityType = typeof(Product), PrimaryKey = "Id", IndexName = "products"},
};
}, (options, services) =>
{
options.AddElasticSyncPostgreSqlServices(services, connectionString);
});
1.2 Use Real-Time Sync With Multiple Workers for High Volume Data Changes
builder.Services.AddElasticSyncEngine(options =>
{
options.ElasticsearchUrl = builder.Configuration["Elasticsearch:Uri"];
options.RealTimeSync()
.EnableMultipleWorkers(new WorkerOptions
{
BatchSizePerWorker = 300,
NumberOfWorkers = 4
});
options.MaxRetries = 5;
options.RetryDelayInSeconds = 20;
options.Entities = new List<TrackedEntity>
{
new TrackedEntity { Table = "Customers", EntityType = typeof(Customer), PrimaryKey = "Id", IndexName = "customers"},
new TrackedEntity { Table = "Products", EntityType = typeof(Product), PrimaryKey = "Id", IndexName = "products"},
};
}, (options, services) =>
{
options.AddElasticSyncPostgreSqlServices(services, connectionString);
});
1.2 Use Interval Sync
builder.Services.AddElasticSyncEngine(options =>
{
options.ElasticsearchUrl = builder.Configuration["Elasticsearch:Uri"];
options.IntervalSync(intervalInSeconds: 20, batchSize: 500);
options.MaxRetries = 5;
options.RetryDelayInSeconds = 20;
options.Entities = new List<TrackedEntity>
{
new TrackedEntity { Table = "Customers", EntityType = typeof(Customer), PrimaryKey = "Id", IndexName = "customers"},
new TrackedEntity { Table = "Products", EntityType = typeof(Product), PrimaryKey = "Id", IndexName = "products"},
};
}, (options, services) =>
{
options.AddElasticSyncPostgreSqlServices(services, connectionString);
});
1.2 Use Interval Sync With Multiple Workers for High Volume Data Changes
builder.Services.AddElasticSyncEngine(options =>
{
options.ElasticsearchUrl = builder.Configuration["Elasticsearch:Uri"];
options.IntervalSync(intervalInSeconds: 20, batchSize: 500)
.EnableMultipleWorkers(new WorkerOptions
{
BatchSizePerWorker = 300,
NumberOfWorkers = 4 //number of parallel worker
});
options.MaxRetries = 5;
options.RetryDelayInSeconds = 20;
options.Entities = new List<TrackedEntity>
{
new TrackedEntity { Table = "Customers", EntityType = typeof(Customer), PrimaryKey = "Id", IndexName = "customers"},
new TrackedEntity { Table = "Products", EntityType = typeof(Product), PrimaryKey = "Id", IndexName = "products"},
};
}, (options, services) =>
{
options.AddElasticSyncPostgreSqlServices(services, connectionString);
});
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. |
-
net8.0
- Elasticsearch.Net (>= 7.17.5)
- Microsoft.Extensions.Hosting (>= 7.0.0)
- Microsoft.Extensions.Options (>= 7.0.0)
- Nest (>= 7.17.5)
- Npgsql (>= 7.0.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ElasticSync.NET:
Package | Downloads |
---|---|
ElasticSync.NET.PostgreSql
Real-time/Interval based high-performance .NET library that sync data between Elasticsearch and PostgreSql database |
GitHub repositories
This package is not used by any popular GitHub repositories.