Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 1.15 KB

File metadata and controls

46 lines (34 loc) · 1.15 KB
endpoint info
lang java
es_version 9.3
client co.elastic.clients:elasticsearch-java:9.3.0

Elasticsearch 9.3 info endpoint (Java example)

Use client.info() to retrieve basic information about the Elasticsearch cluster, including its version, name, and unique ID.

var info = client.info();

System.out.println("Cluster: " + info.clusterName());
System.out.println("Node:    " + info.name());
System.out.println("Version: " + info.version().number());

Version checking

Use the version information to verify compatibility before performing operations that depend on specific features:

var info = client.info();
int major = Integer.parseInt(info.version().number().split("\\.")[0]);

if (major < 9) {
    throw new RuntimeException(
        "Requires Elasticsearch 9.x, found " + info.version().number());
}

Build details

The version object includes build metadata useful for diagnostics:

var version = client.info().version();

System.out.println("Build type:   " + version.buildType());
System.out.println("Build hash:   " + version.buildHash());
System.out.println("Lucene:       " + version.luceneVersion());