Skip to content

Elasticsearch.Net/NEST client for logging to MiniProfiler

License

Notifications You must be signed in to change notification settings

romansp/MiniProfiler.Elasticsearch

Repository files navigation

MiniProfiler.Elasticsearch

Put your Elasticsearch.Net and NEST requests timings directly into MiniProfiler.

Build status Nuget feed

profiler-popup profiler-queries

Usage

You have two options on how to start profiling your Elastic requests.

Option 1. Register in services collection

In your Startup.cs, call AddElastic():

public void ConfigureServices(IServiceCollection services)
{
    services.AddMiniProfiler(options => {
        options.ExcludeElasticAssemblies();
    })
    .AddElastic();
}

Option 2. Create profiled client manually

Update usages of ElasticClient or ElasticLowLevelClient with their respected profiled version ProfiledElasticClient or ProfiledElasticLowLevelClient.

services.AddSingleton<IElasticClient>(x => 
{
    var node = new Uri("http://localhost:9200");
    var connectionSettings = new ConnectionSettings(node).DefaultIndex("elasticsearch-sample");
    return new ProfiledElasticClient(connectionSettings);
});

Sample

See Sample.Elasticsearch.Core for working example.

About

Elasticsearch.Net/NEST client for logging to MiniProfiler

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages