# How to get statusCode from SearchResponse in Java Client

**URL:** <https://forum.opensearch.org/t/how-to-get-statuscode-from-searchresponse-in-java-client/19660>\
**Category:** OpenSearch Client Libraries\
**Tags:** opensearch-java\
**Created:** [May 31, 2024, 6:46pm UTC](https://forum.opensearch.org/t/how-to-get-statuscode-from-searchresponse-in-java-client/19660 "2024-05-31T18:46:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dishatkr](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@dishatkr](https://forum.opensearch.org/u/dishatkr)\
**Post date:** [May 31, 2024, 6:46pm UTC](https://forum.opensearch.org/t/how-to-get-statuscode-from-searchresponse-in-java-client/19660/1 "2024-05-31T18:46:44Z")

</div>

**Versions** (relevant - OpenSearch/Dashboard/Server OS/Browser):  
2.5

**Describe the issue** :  
I’m moving from restHighLevelClient to Openserach java Client V2.5  
In the SearchResponse of RestHighLevelClient, there is a method to know the status Code returned by Opensearch. - [OpenSearch/server/src/main/java/org/opensearch/action/search/SearchResponse.java at fffd1010e88baf332f2dd4169d69bfcf0a869780 · opensearch-project/OpenSearch · GitHub](https://github.com/opensearch-project/OpenSearch/blob/fffd1010e88baf332f2dd4169d69bfcf0a869780/server/src/main/java/org/opensearch/action/search/SearchResponse.java#L199)

We don’t see any similar method in the SearchResponse of Openserach Java Client. What could be the alternative to get the status in this case ?

> <https://github.com/opensearch-project/opensearch-java/blob/db50b7d6089c6fbc988736863b36368d2a8cdad4/java-client/src/main/java/org/opensearch/client/opensearch/core/SearchResponse.java#L48>

**Configuration** :  
NA

**Relevant Logs or Screenshots** :  
NA

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/3/33547ea01a5b12dcca2958411d3edd97ae2ea8c1.png) [@system](https://forum.opensearch.org/u/system)\
**Post date:** [July 30, 2024, 6:47pm UTC](https://forum.opensearch.org/t/how-to-get-statuscode-from-searchresponse-in-java-client/19660/2 "2024-07-30T18:47:06Z")

</div>

Closed on July 30, 2024, 6:47pm UTC

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