# Elasticsearch: healthcheck for embedded web application?

**URL:** <https://discuss.elastic.co/t/elasticsearch-healthcheck-for-embedded-web-application/9338>\
**Category:** Elasticsearch\
**Created:** [October 12, 2012, 2:26pm UTC](https://discuss.elastic.co/t/elasticsearch-healthcheck-for-embedded-web-application/9338 "2012-10-12T14:26:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Sanwald](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul_sanwald/32/2076_2.png) [@Paul\_Sanwald](https://discuss.elastic.co/u/Paul_Sanwald)\
**Post date:** [October 12, 2012, 2:26pm UTC](https://discuss.elastic.co/t/elasticsearch-healthcheck-for-embedded-web-application/9338/1 "2012-10-12T14:26:55Z")

</div>

Hi,  
I've got a webapp, deployed on elastic beanstalk, that has an embedded  
instance of elasticsearch. I want to write a healthcheck servlet to test  
connectivity. I know that I can use the builtin health api, but I'm  
wondering if this is really the droid I'm looking for.

Ultimately, I think I want to test that my transport client (in the webapp)  
can connect to a node, execute a search, and not get an exception (such as  
NoNodeAvailable). Of course, my results shouldn't matter, or depend on the  
state of the index.

am I over thinking this? if not, what would an appropriate query be,  
matchAll() with a size of 1?

--paul

--

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [October 15, 2012, 10:43pm UTC](https://discuss.elastic.co/t/elasticsearch-healthcheck-for-embedded-web-application/9338/2 "2012-10-15T22:43:19Z")

</div>

It depends on what you are looking for by "testing connectivity". Do you  
want to manage a persistent connection (keep alive / heartbeat)? Or do you  
want to check if the cluster is operational? Or degraded? Just let a REST  
client or the TransportClient check for green cluster state. Executing  
expensive queries is not required just for connectivity tests.

Jörg

On Friday, October 12, 2012 4:26:55 PM UTC+2, Paul Sanwald wrote:

> Hi,  
> I've got a webapp, deployed on elastic beanstalk, that has an embedded  
> instance of elasticsearch. I want to write a healthcheck servlet to test  
> connectivity. I know that I can use the builtin health api, but I'm  
> wondering if this is really the droid I'm looking for.
> 
> Ultimately, I think I want to test that my transport client (in the  
> webapp) can connect to a node, execute a search, and not get an exception  
> (such as NoNodeAvailable). Of course, my results shouldn't matter, or  
> depend on the state of the index.
> 
> am I over thinking this? if not, what would an appropriate query be,  
> matchAll() with a size of 1?
> 
> --paul

--

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:08am UTC](https://discuss.elastic.co/t/elasticsearch-healthcheck-for-embedded-web-application/9338/3 "2017-07-06T03:08:42Z")

</div>


