Put your Elasticsearch.Net and NEST requests timings directly into MiniProfiler.
You have two options on how to start profiling your Elastic requests.
In your Startup.cs
, call AddElastic()
:
public void ConfigureServices(IServiceCollection services)
{
services.AddMiniProfiler(options => {
options.ExcludeElasticAssemblies();
})
.AddElastic();
}
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);
});
See Sample.Elasticsearch.Core for working example.