public class EsIndexDocsHealthCheck
extends com.codahale.metrics.health.HealthCheck
HealthCheck which checks if one or more indices in Elasticsearch contain a given number of documents
in their primaries.| Constructor and Description |
|---|
EsIndexDocsHealthCheck(org.elasticsearch.client.Client client,
List<String> indices)
Construct a new Elasticsearch index document count health check.
|
EsIndexDocsHealthCheck(org.elasticsearch.client.Client client,
List<String> indices,
long documentThreshold)
Construct a new Elasticsearch index document count health check.
|
EsIndexDocsHealthCheck(org.elasticsearch.client.Client client,
String indexName)
Construct a new Elasticsearch index document count health check.
|
EsIndexDocsHealthCheck(org.elasticsearch.client.Client client,
String indexName,
long documentThreshold)
Construct a new Elasticsearch index document count health check.
|
| Modifier and Type | Method and Description |
|---|---|
protected com.codahale.metrics.health.HealthCheck.Result |
check()
Perform a check of the number of documents in the Elasticsearch indices.
|
public EsIndexDocsHealthCheck(org.elasticsearch.client.Client client,
List<String> indices,
long documentThreshold)
client - an Elasticsearch Client instance connected to the clusterindices - a List of indices in Elasticsearch which should be checkeddocumentThreshold - the minimal number of documents in an indexIllegalArgumentException - if indices was null or empty,
or documentThreshold was less than 1public EsIndexDocsHealthCheck(org.elasticsearch.client.Client client,
List<String> indices)
client - an Elasticsearch Client instance connected to the clusterindices - a List of indices in Elasticsearch which should be checkedpublic EsIndexDocsHealthCheck(org.elasticsearch.client.Client client,
String indexName,
long documentThreshold)
client - an Elasticsearch Client instance connected to the clusterindexName - the index in Elasticsearch which should be checkeddocumentThreshold - the minimal number of documents in an indexpublic EsIndexDocsHealthCheck(org.elasticsearch.client.Client client,
String indexName)
client - an Elasticsearch Client instance connected to the clusterindexName - the index in Elasticsearch which should be checkedprotected com.codahale.metrics.health.HealthCheck.Result check()
throws Exception
check in class com.codahale.metrics.health.HealthCheckHealthCheck.Result; otherwise, an unhealthy
HealthCheck.Result with a descriptive error message or exceptionException - if there is an unhandled error during the health check; this will result in
a failed health checkCopyright © 2016. All rights reserved.