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?
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 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 .
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.