Skip to content

Latest commit

 

History

History
31 lines (25 loc) · 581 Bytes

File metadata and controls

31 lines (25 loc) · 581 Bytes
endpoint ping
lang ruby
es_version 9.3
client elasticsearch==9.3.0

Elasticsearch 9.3 ping endpoint (Ruby example)

Use client.ping to check whether the Elasticsearch server is reachable. Returns true if the server responds, false otherwise.

if client.ping
  puts 'Elasticsearch is available'
else
  puts 'Elasticsearch is not reachable'
end

Startup health check

Use ping at application startup to fail fast if Elasticsearch is unavailable:

unless client.ping
  warn 'Cannot connect to Elasticsearch — exiting'
  exit 1
end