Best way to check if elasticsearch is up (with symfony + elastica)

Hello!

I don't want to break my website when elasticsearch is down or even not installed.
The features depending on elasticsearch should be temporarly disabled when elasticsearch is not available.

What's the best way to check the elasticsearch availability without slowing down all pages?

  • a test curl request on the beginning of each page?
  • a job in the background checking the availability and changing a conf or database entry, read on each page?

Does elastica offer a test function for elasticsearch availability? (I didn't find it)

How to enable/disable elastica "update_on_save" feature on the fly?

Thank you

Performing an http get on / should tell you if elasticsearch is up. That is
a fairly fast thing, but personally I wouldn't want to do it on each
request. I'd just catch connection errors and degrade that part or the
page.