elasticsearchHow do I use cURL to perform an Elasticsearch health check?
To perform an Elasticsearch health check using cURL, you can use the following example code:
curl -XGET 'localhost:9200/_cluster/health?pretty'
The output of the command will show the health of the cluster, such as the status (green, yellow, or red), the number of nodes, and the number of data nodes:
{
"cluster_name" : "elasticsearch",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 3,
"number_of_data_nodes" : 2,
"active_primary_shards" : 5,
"active_shards" : 10,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 100.0
}
The code consists of the following parts:
curl
- the command line tool used to make the request-XGET
- the type of request to make (in this case, a GET request)localhost:9200
- the host and port of the Elasticsearch cluster_cluster/health
- the endpoint to hit for the health check?pretty
- an optional parameter to make the output more readable
For more information about using cURL to perform an Elasticsearch health check, see this page.
More of Elasticsearch
- How can I use elasticsearch zone awareness to improve my software development?
- How can I use Elasticsearch with Zammad?
- How do I set up an Elasticsearch Yum repository?
- How can I use Elasticsearch to diagnose "yellow" issues?
- How can I use YouTube to learn about Elasticsearch?
- How can I set up and use Elasticsearch on the Yandex Cloud platform?
- How can I get started with using Elasticsearch OSS?
- How do I use ElasticSearch to zip files?
- What hardware do I need to run Elasticsearch?
- How can I use Elasticsearch and ZFS together?
See more codes...