How to Check Elasticsearch Version?

Elasticsearch, a powerful open-source search and analytics engine, is widely used for handling structured and unstructured data. Knowing the version of Elasticsearch running in your environment is essential for ensuring compatibility with plugins, integrations, and security updates. This guide provides detailed steps to check the Elasticsearch version on different platforms and environments.

Why Check Elasticsearch Version?

Elasticsearch

  1. Compatibility: Certain features, APIs, and plugins are version-specific, requiring a compatible Elasticsearch version.
  2. Security: Keeping track of your Elasticsearch version helps identify outdated versions that might have vulnerabilities.
  3. Features and Enhancements: New Elasticsearch versions often include performance improvements, bug fixes, and new features.
  4. Troubleshooting: Identifying the Elasticsearch version is essential when resolving issues or debugging errors.

How to Check Elasticsearch Version

Below are several methods to determine the Elasticsearch version in different environments.

1. Using the Elasticsearch REST API

The REST API is the most straightforward way to check the Elasticsearch version.

Steps:

1. Open a terminal or command-line tool.

2. Use the curl command to query the Elasticsearch server:

curl -X GET “http://<hostname>:9200/”

3. Replace <hostname> with the address of your Elasticsearch server. If Elasticsearch is running locally, use localhost.
The response will contain the version information. Example output:
{
“name” : “node-1”,
“cluster_name” : “elasticsearch”,
“cluster_uuid” : “1a2b3c4d”,
“version” : {
“number” : “7.17.0”,
“build_flavor” : “default”,
“build_type” : “tar”,
“build_hash” : “1a2b3c4d567e”,
“build_date” : “2022-01-13T10:00:00Z”,
“build_snapshot” : false,
“lucene_version” : “8.11.0”,
“minimum_wire_compatibility_version” : “6.8.0”,
“minimum_index_compatibility_version” : “6.0.0-beta1”
},
“tagline” : “You Know, for Search”
}

In this example, the Elasticsearch version is 7.17.0.

2. Using the Elasticsearch Logs

Elasticsearch logs contain detailed information about the version, especially during startup.

Steps:

1. Navigate to the Elasticsearch logs directory. By default, it is located at:

/var/log/elasticsearch/

2. Open the elasticsearch.log file using a text editor or viewer:

cat /var/log/elasticsearch/elasticsearch.log

3. Search for the version information in the log file. Example:

[2022-01-13T10:00:00,123][INFO ][o.e.n.Node ] version[7.17.0], pid[12345], build[default/tar/1a2b3c4d567e/2022-01-13T10:00:00Z]

3. Using Kibana

If you are using Kibana, it can display the Elasticsearch version it is connected to.

Steps:

  • Open the Kibana dashboard in your web browser.
  • Navigate to Management > Stack Management > Elasticsearch.
  • The version information will be displayed in the Elasticsearch Cluster section.

4. Checking the Installation Directory

The Elasticsearch version is often stored in the manifest.yml or pom.properties file within the installation directory.

Steps:

1. Navigate to the Elasticsearch installation directory. For example:

/usr/share/elasticsearch/

2. Open the manifest.yml file:

cat /usr/share/elasticsearch/modules/x-pack-core/manifest.yml

3. Look for the version field in the file.

Alternatively, you can check the pom.properties file:

cat /usr/share/elasticsearch/lib/elasticsearch-*.jar/META-INF/maven/org.elasticsearch/elasticsearch/pom.properties

5. Using a Package Manager

If Elasticsearch was installed using a package manager, you can check the version through the package management system.

  • For Debian/Ubuntu:
    • dpkg -l | grep elasticsearch
  • For Red Hat/CentOS:
    • rpm -qi elasticsearch

Output:

The version will be displayed in the output, such as:

Name : elasticsearch
Version : 7.17.0
Release : 1

Troubleshooting Tips

1. Elasticsearch Not Running: Ensure the Elasticsearch service is running using:

systemctl status elasticsearch

2. Firewall Restrictions: If accessing Elasticsearch remotely, ensure that port 9200 is open and reachable.

3. Authentication: For secured clusters, include authentication credentials in the curl command:

curl -u username:password -X GET “http://<hostname>:9200/”

Conclusion

Checking the Elasticsearch version is a simple but crucial task for maintaining compatibility, ensuring security, and troubleshooting issues. Whether you use the REST API, logs, Kibana, or package management tools, it’s easy to identify your version and take necessary actions, such as updates or configurations, based on the results. Regularly verify your Elasticsearch version to stay up-to-date and secure

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *