Class ElasticsearchHealthIndicator

  • 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.rest.high.level.enabled",notEquals="false")
    @Singleton
    public class ElasticsearchHealthIndicator
    extends java.lang.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
    • Field Summary

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

        HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
    • Constructor Summary

      Constructors 
      Constructor Description
      ElasticsearchHealthIndicator​(org.elasticsearch.client.RestHighLevelClient esClient)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      • 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 Detail

      • ElasticsearchHealthIndicator

        public ElasticsearchHealthIndicator​(org.elasticsearch.client.RestHighLevelClient esClient)
        Constructor.
        Parameters:
        esClient - The Elasticsearch high level REST client.
    • Method Detail

      • 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.