Elasticsearch Index Health Indicator
Permite verificar el estado de un indice dentro del cluster de elasticsearch.
Registrar en el contenedor de IoC¶
Para registrar el HealthIndicator deberemos pasar como parametro la URL del cluster de elasticsearch y el nombre del indice.
public void Configure(IWebHostBuilder builder)
{
builder.ConfigureServices((ctx, c) =>
{
c.AddSingleton<IHealthIndicator, ElasticsearchIndexHealthIndicator>(s =>
new ElasticsearchIndexHealthIndicator("http://elastic.test.andreani.com.ar:9200", "nao_v5")
);
});
}
/health
endpoint, podremos visualizar lo siguiente:
{
"status": {
"code": "UP",
"description": ""
},
"details": {
"elasticsearchIndexHealthIndicator": {
"status": {
"code": "UP",
"description": ""
},
"details": {
"health": "yellow",
"status": "open",
"index": "nao_v5",
"docs.count": "101354",
"docs.deleted": "77",
"store.size": "27.8mb"
}
}
}
}