| endpoint | ping |
|---|---|
| lang | ruby |
| es_version | 9.3 |
| client | elasticsearch==9.3.0 |
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'
endUse ping at application startup to fail fast if Elasticsearch is
unavailable:
unless client.ping
warn 'Cannot connect to Elasticsearch — exiting'
exit 1
end