# Status of an indexResponse in JAVA API

**URL:** <https://discuss.elastic.co/t/status-of-an-indexresponse-in-java-api/12664>\
**Category:** Elasticsearch\
**Created:** [July 4, 2013, 1:30pm UTC](https://discuss.elastic.co/t/status-of-an-indexresponse-in-java-api/12664 "2013-07-04T13:30:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manoj\_Mohan\_2](https://avatars.discourse-cdn.com/v4/letter/m/e9a140/32.png) [@Manoj\_Mohan\_2](https://discuss.elastic.co/u/Manoj_Mohan_2)\
**Post date:** [July 4, 2013, 1:30pm UTC](https://discuss.elastic.co/t/status-of-an-indexresponse-in-java-api/12664/1 "2013-07-04T13:30:39Z")

</div>

Hi all,

I am using the java api for elasticsearch and was unable to find how to  
check the status of my index response. If I create a percolator using the  
following query

client.prepareIndex("\_percolator", indexName, percolatorName)  
.setSource(\<some\_query\>))  
.setRefresh(true).execute().actionGet()

I get an index response. However I was unable to find a variable/method in  
the same class returning the status of the operation, ie whether it was  
successful or failed. I do get some data like id, version. Does a failure  
not return id, version fields etc ??

Any help would be greatly appreciated.

Manoj Mohan

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [July 4, 2013, 1:42pm UTC](https://discuss.elastic.co/t/status-of-an-indexresponse-in-java-api/12664/2 "2013-07-04T13:42:38Z")

</div>

Hey,

if the index response is returned (and therefore no exception has been  
thrown), the index operation was successful.

--Alex

On Thu, Jul 4, 2013 at 3:30 PM, Manoj Mohan [manoj@intelligrape.com](mailto:manoj@intelligrape.com) wrote:

> Hi all,
> 
> I am using the java api for elasticsearch and was unable to find how to  
> check the status of my index response. If I create a percolator using the  
> following query
> 
> client.prepareIndex("\_percolator", indexName, percolatorName)  
> .setSource(\<some\_query\>))  
> .setRefresh(true).execute().actionGet()
> 
> I get an index response. However I was unable to find a variable/method in  
> the same class returning the status of the operation, ie whether it was  
> successful or failed. I do get some data like id, version. Does a failure  
> not return id, version fields etc ??
> 
> Any help would be greatly appreciated.
> 
> Manoj Mohan
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Manoj\_Mohan\_2](https://avatars.discourse-cdn.com/v4/letter/m/e9a140/32.png) [@Manoj\_Mohan\_2](https://discuss.elastic.co/u/Manoj_Mohan_2)\
**Post date:** [July 4, 2013, 2:15pm UTC](https://discuss.elastic.co/t/status-of-an-indexresponse-in-java-api/12664/3 "2013-07-04T14:15:08Z")

</div>

Hmm.. thanks .. From the name it seemed it would give me a response  
regardless of a success or a failure ....

On Thursday, July 4, 2013 7:12:38 PM UTC+5:30, Alexander Reelsen wrote:

> Hey,
> 
> if the index response is returned (and therefore no exception has been  
> thrown), the index operation was successful.
> 
> --Alex
> 
> On Thu, Jul 4, 2013 at 3:30 PM, Manoj Mohan \<[ma...@intelligrape.com](mailto:ma...@intelligrape.com)\<javascript:\>
> 
> > wrote:
> 
> > Hi all,
> > 
> > I am using the java api for elasticsearch and was unable to find how to  
> > check the status of my index response. If I create a percolator using the  
> > following query
> > 
> > client.prepareIndex("\_percolator", indexName, percolatorName)  
> > .setSource(\<some\_query\>))  
> > .setRefresh(true).execute().actionGet()
> > 
> > I get an index response. However I was unable to find a variable/method  
> > in the same class returning the status of the operation, ie whether it was  
> > successful or failed. I do get some data like id, version. Does a failure  
> > not return id, version fields etc ??
> > 
> > Any help would be greatly appreciated.
> > 
> > Manoj Mohan
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Manoj\_Mohan\_2](https://avatars.discourse-cdn.com/v4/letter/m/e9a140/32.png) [@Manoj\_Mohan\_2](https://discuss.elastic.co/u/Manoj_Mohan_2)\
**Post date:** [July 4, 2013, 2:20pm UTC](https://discuss.elastic.co/t/status-of-an-indexresponse-in-java-api/12664/4 "2013-07-04T14:20:50Z")

</div>

Would the same be true for a SearchResponse? I am asking that because I see  
a status method there that gives me a rest status.

Regards  
Manoj Mohan  
Intelligrape Software

On Thu, Jul 4, 2013 at 7:45 PM, Manoj Mohan [manoj@intelligrape.com](mailto:manoj@intelligrape.com) wrote:

> Hmm.. thanks .. From the name it seemed it would give me a response  
> regardless of a success or a failure ....
> 
> On Thursday, July 4, 2013 7:12:38 PM UTC+5:30, Alexander Reelsen wrote:
> 
> > Hey,
> > 
> > if the index response is returned (and therefore no exception has been  
> > thrown), the index operation was successful.
> > 
> > --Alex
> > 
> > On Thu, Jul 4, 2013 at 3:30 PM, Manoj Mohan [ma...@intelligrape.com](mailto:ma...@intelligrape.com)wrote:
> > 
> > > Hi all,
> > > 
> > > I am using the java api for elasticsearch and was unable to find how to  
> > > check the status of my index response. If I create a percolator using the  
> > > following query
> > > 
> > > client.prepareIndex("\_\*\*percolator", indexName, percolatorName)  
> > > .setSource(\<some\_query\>))  
> > > .setRefresh(true).execute().\*\*actionGet()
> > > 
> > > I get an index response. However I was unable to find a variable/method  
> > > in the same class returning the status of the operation, ie whether it was  
> > > successful or failed. I do get some data like id, version. Does a failure  
> > > not return id, version fields etc ??
> > > 
> > > Any help would be greatly appreciated.
> > > 
> > > Manoj Mohan
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to elasticsearc...@\*\*[googlegroups.com](http://googlegroups.com).
> > > 
> > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > .
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/EpzWY3Rq7WM/unsubscribe](https://groups.google.com/d/topic/elasticsearch/EpzWY3Rq7WM/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [July 4, 2013, 3:32pm UTC](https://discuss.elastic.co/t/status-of-an-indexresponse-in-java-api/12664/5 "2013-07-04T15:32:56Z")

</div>

Hey,

a search response is a bit different than a IndexResponse. A index response  
simply returns that it has worked, but a SearchResponse can have more than  
one status. For example individual shards can fail, but this still is a  
valid search response (but yields a different HTTP response code for  
example).

Hope this helps, if you need further information, just ask.

--Alex

On Thu, Jul 4, 2013 at 4:20 PM, Manoj Mohan [manoj@intelligrape.com](mailto:manoj@intelligrape.com) wrote:

> Would the same be true for a SearchResponse? I am asking that because I  
> see a status method there that gives me a rest status.
> 
> Regards  
> Manoj Mohan  
> Intelligrape Software
> 
> On Thu, Jul 4, 2013 at 7:45 PM, Manoj Mohan [manoj@intelligrape.com](mailto:manoj@intelligrape.com)wrote:
> 
> > Hmm.. thanks .. From the name it seemed it would give me a response  
> > regardless of a success or a failure ....
> > 
> > On Thursday, July 4, 2013 7:12:38 PM UTC+5:30, Alexander Reelsen wrote:
> > 
> > > Hey,
> > > 
> > > if the index response is returned (and therefore no exception has been  
> > > thrown), the index operation was successful.
> > > 
> > > --Alex
> > > 
> > > On Thu, Jul 4, 2013 at 3:30 PM, Manoj Mohan [ma...@intelligrape.com](mailto:ma...@intelligrape.com)wrote:
> > > 
> > > > Hi all,
> > > > 
> > > > I am using the java api for elasticsearch and was unable to find how to  
> > > > check the status of my index response. If I create a percolator using the  
> > > > following query
> > > > 
> > > > client.prepareIndex("\_\*\*percolator", indexName, percolatorName)  
> > > > .setSource(\<some\_query\>))  
> > > > .setRefresh(true).execute().\*\*actionGet()
> > > > 
> > > > I get an index response. However I was unable to find a variable/method  
> > > > in the same class returning the status of the operation, ie whether it was  
> > > > successful or failed. I do get some data like id, version. Does a failure  
> > > > not return id, version fields etc ??
> > > > 
> > > > Any help would be greatly appreciated.
> > > > 
> > > > Manoj Mohan
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to the Google  
> > > > Groups "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an email to elasticsearc...@\*\*[googlegroups.com](http://googlegroups.com).
> > > > 
> > > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > > .
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/EpzWY3Rq7WM/unsubscribe](https://groups.google.com/d/topic/elasticsearch/EpzWY3Rq7WM/unsubscribe).  
> > > To unsubscribe from this group and all its topics, send an email to  
> > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).
> > 
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [July 4, 2013, 5:24pm UTC](https://discuss.elastic.co/t/status-of-an-indexresponse-in-java-api/12664/6 "2013-07-04T17:24:19Z")

</div>

The question is what you want to see to succeed or fail.

In the index request, you can specify a write consistency level (one,  
quorum, all), and a replication type (sync, async). Normally you see an  
async index response after the index request has been dispatched to the  
participating nodes and a quorum of nodes responded. This is before the  
document persists across all participating nodes. But you can change the  
setting in the write consistency level.

Jörg

Am 04.07.13 16:15, schrieb Manoj Mohan:

> Hmm.. thanks .. From the name it seemed it would give me a response  
> regardless of a success or a failure ....

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:28am UTC](https://discuss.elastic.co/t/status-of-an-indexresponse-in-java-api/12664/7 "2017-07-06T02:28:09Z")

</div>


