# General: ES response errors

**URL:** <https://discuss.elastic.co/t/general-es-response-errors/9988>\
**Category:** Elasticsearch\
**Created:** [December 7, 2012, 3:14pm UTC](https://discuss.elastic.co/t/general-es-response-errors/9988 "2012-12-07T15:14:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marcin\_Dojwa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marcin_dojwa/32/2307_2.png) [@Marcin\_Dojwa](https://discuss.elastic.co/u/Marcin_Dojwa)\
**Post date:** [December 7, 2012, 3:14pm UTC](https://discuss.elastic.co/t/general-es-response-errors/9988/1 "2012-12-07T15:14:44Z")

</div>

Hi,

Is there any way to distinguish error messages in responses between errors  
due to request error (eg wrong format etc) that will always be returned for  
specified request and errors due to server problems. I need to know when  
should I retry the request and when not. Eg, the response error due to  
server error is 'UnavailableShardsException', and with such error I should  
retry the request until success. The response error due to request problem  
is eg 'SearchPhaseExecutionException' - here I should give up running this  
request because it will never succeed.

Thanks.  
Best regards.  
Marcin Dojwa

--

---

<div class="post-metadata">

**Author:** ![Anil\_Rhemtulla](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@Anil\_Rhemtulla](https://discuss.elastic.co/u/Anil_Rhemtulla)\
**Post date:** [December 7, 2012, 4:49pm UTC](https://discuss.elastic.co/t/general-es-response-errors/9988/2 "2012-12-07T16:49:32Z")

</div>

This is probably much more kludgy that what you're looking for, but you  
could use the validate API to ensure the request is valid:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

On Friday, December 7, 2012 7:14:44 AM UTC-8, Marcin Dojwa wrote:

> Hi,
> 
> Is there any way to distinguish error messages in responses between errors  
> due to request error (eg wrong format etc) that will always be returned for  
> specified request and errors due to server problems. I need to know when  
> should I retry the request and when not. Eg, the response error due to  
> server error is 'UnavailableShardsException', and with such error I should  
> retry the request until success. The response error due to request problem  
> is eg 'SearchPhaseExecutionException' - here I should give up running this  
> request because it will never succeed.
> 
> Thanks.  
> Best regards.  
> Marcin Dojwa

--

---

<div class="post-metadata">

**Author:** ![Marcin\_Dojwa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marcin_dojwa/32/2307_2.png) [@Marcin\_Dojwa](https://discuss.elastic.co/u/Marcin_Dojwa)\
**Post date:** [December 7, 2012, 7:08pm UTC](https://discuss.elastic.co/t/general-es-response-errors/9988/3 "2012-12-07T19:08:32Z")

</div>

I guess I can use it if there is no other way, I will do the \_validate  
request on each response error to check if I should give up or retry the  
request. Thanks 🙂 Do you know how \_validate works when I pass a request  
that throws 'UnavailableShardsException'? Do I get "valid":true or '  
UnavailableShardsException' error too ?

2012/12/7 Anil Rhemtulla [anil.rhemtulla@gmail.com](mailto:anil.rhemtulla@gmail.com)

> This is probably much more kludgy that what you're looking for, but you  
> could use the validate API to ensure the request is valid:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/validate.html)
> 
> On Friday, December 7, 2012 7:14:44 AM UTC-8, Marcin Dojwa wrote:
> 
> > Hi,
> > 
> > Is there any way to distinguish error messages in responses between  
> > errors due to request error (eg wrong format etc) that will always be  
> > returned for specified request and errors due to server problems. I need to  
> > know when should I retry the request and when not. Eg, the response error  
> > due to server error is 'UnavailableShardsException', and with such error I  
> > should retry the request until success. The response error due to request  
> > problem is eg '\*\*SearchPhaseExecutionException' - here I should give up  
> > running this request because it will never succeed.
> > 
> > Thanks.  
> > Best regards.  
> > Marcin Dojwa
> 
> --

--

---

<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:00am UTC](https://discuss.elastic.co/t/general-es-response-errors/9988/4 "2017-07-06T03:00:48Z")

</div>


