Class ElasticsearchClientHealthIndicator

java.lang.Object
io.micronaut.elasticsearch.health.ElasticsearchClientHealthIndicator
All Implemented Interfaces:
io.micronaut.core.order.Ordered, io.micronaut.management.health.indicator.HealthIndicator

@Requires(beans=io.micronaut.management.endpoint.health.HealthEndpoint.class) @Requires(property="endpoints.health.elasticsearch.enabled",notEquals="false") @Singleton public class ElasticsearchClientHealthIndicator extends Object implements io.micronaut.management.health.indicator.HealthIndicator
A HealthIndicator for Elasticsearch that uses an automatically-configured high-level REST client, injected as a dependency, to communicate with Elasticsearch.
Since:
1.0.0
Author:
Puneet Behl, Robyn Dalgleish
  • Field Summary

    Fields inherited from interface io.micronaut.core.order.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    ElasticsearchClientHealthIndicator(co.elastic.clients.elasticsearch.ElasticsearchAsyncClient client)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.reactivestreams.Publisher<io.micronaut.management.health.indicator.HealthResult>
    Tries to call the cluster info API on Elasticsearch to obtain information about the cluster.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.micronaut.core.order.Ordered

    getOrder
  • Constructor Details

    • ElasticsearchClientHealthIndicator

      public ElasticsearchClientHealthIndicator(co.elastic.clients.elasticsearch.ElasticsearchAsyncClient client)
      Constructor.
      Parameters:
      client - The Elasticsearch high level REST client.
  • Method Details

    • getResult

      public org.reactivestreams.Publisher<io.micronaut.management.health.indicator.HealthResult> getResult()
      Tries to call the cluster info API on Elasticsearch to obtain information about the cluster. If the call succeeds, the Elasticsearch cluster health status (GREEN / YELLOW / RED) will be included in the health indicator details.
      Specified by:
      getResult in interface io.micronaut.management.health.indicator.HealthIndicator
      Returns:
      A positive health result UP if the cluster can be communicated with and is in either GREEN or YELLOW status. A negative health result DOWN if the cluster cannot be communicated with or is in RED status.