How to Show Your Elasticsearch Version on Ubuntu/Debian

Recently, I provisioned a new Elasticsearch cluster. The installation process on Ubuntu used the apt package manager and everything looked good. I started the application as soon as Elasticsearch booted and was ready for connections.

The app connected to the database, everything looked good. Yet, the Elastic SDK failed while storing data into the database. What version is installed on the newly provisioned VMs?

That’s what this tutorial is all about: how to find the installed Elasticsearch version.

Ubuntu/Debian Series Overview

Show the Elasticsearch Version via cURL

A way to find the Elasticsearch version is an HTTP request. A running Elasticsearch process provides an HTTP API making metadata information about the instance available via HTTP. You can request this information from the command line using cURL:

curl http://localhost:9200  

The response from Elastic looks like this:

{
  "name" : "fwb3uIF",
  "cluster_name" : "hercules",
  "cluster_uuid" : "LKq0lf0lSlmK-DSE-_CQlw",
  "version" : {
    "number" : "6.2.4",
    "build_hash" : "ccec39f",
    "build_date" : "2018-04-12T20:37:28.497551Z",
    "build_snapshot" : false,
    "lucene_version" : "7.2.1",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

Alright, the installed Elasticsearch version is 6.2.4. Looks good!

Show the Elasticsearch Version via the Executable

If the Elasticsearch process isn’t running, you may need to grab the version number using the command line.

At first, navigate your terminal to the Elasticsearch installation directory. When using apt to install the database, you may find it in the /usr/share/elasticsearch directory. When downloading a ZIP file, you can find the executable directly inside the bin folder of the extracted ZIP.

# navigate to the Elasticsearch installation directory
cd /usr/share/elasticsearch  

You’ll find the elasticsearch executable inside the Elasticsearch installation directory. By default, it’s located inside the bin directory.

Starting the database process prints debugging output and startup logs to the console. You may need to start the executable in bin/elasticsearch via sudo, depending on your logged in user and the related access rights. You can grab the version by adding the --version flag:

$ sudo ./bin/elasticsearch --version
OpenJDK 64-Bit Server VM warning: …  
Version: 6.2.4, Build: ccec39f/2018-04-12T20:37:28.497551Z, JVM: 11.0.6  

Alright, the installed Elasticsearch version is 6.2.4.

These are two ways of finding the installed Elasticsearch version. If you know of another way, please share it in the comments below.

Explore the Library

Find interesting tutorials and solutions for your problems.