# Determine success of call to High Level Rest Client synchronous method

**URL:** <https://discuss.elastic.co/t/determine-success-of-call-to-high-level-rest-client-synchronous-method/116086>\
**Category:** Elasticsearch\
**Created:** [January 18, 2018, 3:16pm UTC](https://discuss.elastic.co/t/determine-success-of-call-to-high-level-rest-client-synchronous-method/116086 "2018-01-18T15:16:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevin\_Bourne](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kevin_bourne/32/53053_2.png) [@Kevin\_Bourne](https://discuss.elastic.co/u/Kevin_Bourne)\
**Post date:** [January 18, 2018, 3:16pm UTC](https://discuss.elastic.co/t/determine-success-of-call-to-high-level-rest-client-synchronous-method/116086/1 "2018-01-18T15:16:36Z")

</div>

I am beginning to use the 5.6.4 High Level Rest Client. With respect to using for example the index(indexRequest) method, it returns an IndexResponse. I see the methods available like status and shards, etc...

My question is what exactly do I query in the \*Response objects to determine if the operation was successful? Is it safe to assume that if I receive a \*Response object from a call to the High Level Rest Client that the operation was successful?

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [January 26, 2018, 9:27am UTC](https://discuss.elastic.co/t/determine-success-of-call-to-high-level-rest-client-synchronous-method/116086/2 "2018-01-26T09:27:36Z")

</div>

Hi Kevin,  
the high-level REST client exposes everything that's being returned at REST. With the index API, when the sync call returns an IndexResponse it means that the operation was successful, otherwise an exception would have been thrown (in case for instance a non 2xx response was returned). If you want to know more about whether the replication of the document, if something failed for instance on some replica, then you should check the shards section through the `getShardInfo()` method, which gives you access to `successful`, `failed`, `total` and `failures`. See the index API docs here: [https://www.elastic.co/guide/en/elasticsearch/reference/5.6/docs-index\_.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/docs-index_.html) and also the docs for the high-level REST client: [https://www.elastic.co/guide/en/elasticsearch/client/java-rest/5.6/java-rest-high-document-index.html](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/5.6/java-rest-high-document-index.html) .

Cheers  
Luca

---

<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:** [February 23, 2018, 9:27am UTC](https://discuss.elastic.co/t/determine-success-of-call-to-high-level-rest-client-synchronous-method/116086/3 "2018-02-23T09:27:47Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
