Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 1.02 KB

File metadata and controls

44 lines (32 loc) · 1.02 KB
endpoint info
lang python
es_version 9.3
client elasticsearch==9.3.0

Elasticsearch 9.3 info endpoint (Python example)

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

info = client.info()

print(f"Cluster: {info['cluster_name']}")
print(f"Node:    {info['name']}")
print(f"Version: {info['version']['number']}")

Version checking

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

info = client.info()
major = int(info["version"]["number"].split(".")[0])

if major < 9:
    raise RuntimeError(f"Requires Elasticsearch 9.x, found {info['version']['number']}")

Build details

The version object includes build metadata useful for diagnostics:

version = client.info()["version"]

print(f"Build type:   {version['build_type']}")
print(f"Build hash:   {version['build_hash']}")
print(f"Lucene:       {version['lucene_version']}")