How do I monitor and restart Elasticsearch?

I've had some problems with my server as of late. When certain processes fail they automatically recover and I get notifications via email through WHM. Is there any way to monitor Elasticsearch and have WHM notify me of its failure and automatically restart it?

I'm just looking for solutions that others have used to monitor/restart Elasticsearch if it fails.
I have found ElasticSearch to be extremely reliable so I have not seen any need to monitor if it's running.

You mentioned:

What sort of problems?
The kind of problems that caused Elasticsearch to stop working. :)

It's only happened a couple of times but I've had Elasticsearch down for hours without knowing about it except that I am informed by a user or I see it in the backend error logs. I'm not always looking at the board to realize that search is down and I'm looking for a solution that will notice that the service has failed and attempt to restart it.
Just to clarify, no other server problems besides ElasticSearch stopped working?
To be specific, there were memory problems caused by some malicious traffic that caused Java and mySQL to crash but those two started back up automatically. ElasticSearch did not.

I'm trying to figure out a way for the server to monitor and report that ElasticSearch has stopped and then restart it. If I could only monitor that it stopped at least I would know so I could restart it.


Well-known member
I'ld recommend dedicated monitoring over my add-ons, as they don't cover that situation.

There are several addons by @Xon for Enhanced Search which improve it and provide additional information.
I use Datadog's free plan for monitoring my Elastic Search setup, works well with more information that I'll ever need :p


Well-known member
I had some issues similar to this, where the server crashed and was restarted, but afterwards the search feature stopped returning results for all keywords (using Elasticsearch on XF 1.5). I'm not sure how to check to see if Elasticsearch is working correctly. Should I just rebuild the search index for my 4.4 million post forum?


Well-known member
Should I rebuild the search index for "post" or all? And should I delete the search index before rebuilding? I'm trying to consider load on the server when I do this.

S Thomas

Well-known member
Why would you rebuild the search index when you don't know in the first stance what's causing the erroneous behaviour? You gain nothing from that. Are you on a system with admin access, like SSH, a control panel with root filemanager or something? If so, check elastics logs. Also, if you've installed elastic the standard way, something like service elasticsearch status or similar can give you a good hint. If you're on a managed plan or something without admin access, ask your host to check what's going on.