0
0
ElasticsearchHow-ToBeginner · 3 min read

How to Check if Elasticsearch is Running: Simple Steps

To check if Elasticsearch is running, you can send a request to its default HTTP port (usually 9200) using curl http://localhost:9200. If Elasticsearch is running, it will respond with cluster information in JSON format.
📐

Syntax

Use the curl command to send an HTTP GET request to Elasticsearch's default port 9200. The basic syntax is:

  • curl http://localhost:9200 - checks Elasticsearch on the local machine.
  • curl http://<host>:<port> - replace <host> and <port> with your server's address and port if different.
bash
curl http://localhost:9200
💻

Example

This example shows how to check if Elasticsearch is running on your local machine using curl. If running, it returns JSON with cluster name and version.

bash
curl http://localhost:9200
Output
{ "name" : "node-1", "cluster_name" : "elasticsearch", "cluster_uuid" : "abc123xyz", "version" : { "number" : "8.8.2", "build_flavor" : "default", "build_type" : "tar", "build_hash" : "abcdef123456", "build_date" : "2024-06-01T00:00:00Z", "build_snapshot" : false, "lucene_version" : "9.7.0", "minimum_wire_compatibility_version" : "8.0.0", "minimum_index_compatibility_version" : "8.0.0" }, "tagline" : "You Know, for Search" }
⚠️

Common Pitfalls

Common mistakes when checking if Elasticsearch is running include:

  • Using the wrong port number (default is 9200).
  • Trying to connect to Elasticsearch before it has fully started.
  • Not having curl installed or accessible in your command line.
  • Firewall or network issues blocking access to the port.

Always verify the correct host and port, and ensure Elasticsearch service is started.

bash
curl http://localhost:9300
# Wrong port, no response or error

curl http://localhost:9200
# Correct port, returns JSON if running
📊

Quick Reference

Summary tips to check Elasticsearch status:

  • Default HTTP port: 9200
  • Use curl http://localhost:9200 to test locally
  • Look for JSON response with cluster_name and version
  • Use browser to visit http://localhost:9200 for a quick check
  • Check Elasticsearch service status with system tools (e.g., systemctl status elasticsearch)

Key Takeaways

Use curl to send a request to Elasticsearch's default port 9200 to check if it is running.
A running Elasticsearch responds with JSON containing cluster and version info.
Ensure you use the correct host and port, and that Elasticsearch service is started.
Common errors include wrong port, network blocks, or service not started.
You can also check service status with system commands like systemctl.