Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/romansp/MiniProfiler.Elasticsearch
Elasticsearch.Net/NEST client for logging to MiniProfiler
https://github.com/romansp/MiniProfiler.Elasticsearch
c-sharp elasticsearch miniprofiler nest
Last synced: 2 days ago
JSON representation
Elasticsearch.Net/NEST client for logging to MiniProfiler
- Host: GitHub
- URL: https://github.com/romansp/MiniProfiler.Elasticsearch
- Owner: romansp
- License: mit
- Created: 2015-03-31T12:37:03.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2022-11-30T19:29:38.000Z (almost 2 years ago)
- Last Synced: 2023-08-18T11:44:44.319Z (about 1 year ago)
- Topics: c-sharp, elasticsearch, miniprofiler, nest
- Language: C#
- Size: 1.19 MB
- Stars: 20
- Watchers: 5
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# MiniProfiler.Elasticsearch
Put your [Elasticsearch.Net and NEST](https://github.com/elastic/elasticsearch-net) requests timings directly into [MiniProfiler](https://github.com/MiniProfiler/dotnet).[![Build status](https://ci.appveyor.com/api/projects/status/m15gemuqkcs1rbv4/branch/main?svg=true)](https://ci.appveyor.com/project/romansp/miniprofiler-elasticsearch/branch/main) [![Nuget feed](https://img.shields.io/nuget/vpre/MiniProfiler.Elasticsearch.svg)](https://www.nuget.org/packages/MiniProfiler.Elasticsearch)
![profiler-popup](https://user-images.githubusercontent.com/3474842/30780873-de83efd8-a11d-11e7-8735-49dea4a1d4f1.png)
![profiler-queries](https://user-images.githubusercontent.com/3474842/30780952-edf8adea-a11e-11e7-8d64-c65331f389bf.png)## 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()`:```c#
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`.```c#
services.AddSingleton(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](https://github.com/romansp/MiniProfiler.Elasticsearch/tree/main/samples/Sample.Elasticsearch.Core) for working example.