Elasticsearch REST Response Handling

Successful Response

Elasticsearch REST performRequest api always returned response  for Synchronous by object Response and for Asynchronous by ResponseListener which contain response object. Response object contains other fields as given below:


getHost() api return host information.


getRequestLine() api returned information about performed request.


return response status code by calling getStatusLine()


provide response all header information by api getHeaders() if need to get specific one can get by getHeader(String).


Entity keeps all the content of response which comes after query or filters. We can get this by calling getEntity()

Failure Response or Exception


Communication problem like SocketTimeout etc.


Response received with status code not having 200 for OK. Response Exception not occurs for code 404 which indicate resource is not available.

Read More on Elasticsearch REST


Integrate Filebeat, Kafka, Logstash, Elasticsearch and Kibana

About Saurabh Gupta

My Name is Saurabh Gupta, I have approx. 10 Year of experience in Information Technology World manly in Java/J2EE. During this time I have worked with multiple organization with different client, so many technology, frameworks etc.
This entry was posted in Elasticsearch, REST and tagged , , . Bookmark the permalink.