# SearchResponse as Json

**URL:** <https://discuss.elastic.co/t/searchresponse-as-json/20335>\
**Category:** Elasticsearch\
**Created:** [October 20, 2014, 10:04am UTC](https://discuss.elastic.co/t/searchresponse-as-json/20335 "2014-10-20T10:04:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbabu](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@sbabu](https://discuss.elastic.co/u/sbabu)\
**Post date:** [October 20, 2014, 10:04am UTC](https://discuss.elastic.co/t/searchresponse-as-json/20335/1 "2014-10-20T10:04:35Z")

</div>

Hi All,

I am using elastic search Java client.

Trying to get the Json for a field. My search request...

SearchResponse response = client.prepareSearch(indexName)  
.addFields("reviews")  
.setSearchType(SearchType.QUERY\_AND\_FETCH)  
.setQuery(queryBuilder)  
.execute()  
.actionGet();

I am getting response in terms of Map of Maps, it will be difficult for me to get the data for each field and populate a pojo and searilalize it to send to front end.  
I just want whatever json available in the Elastic search for that field as response.

I did : String responseString = response.toString();

but it gives the response with all the unwanted headers.

Please suggest.  
Thanks  
Babu

---

<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, 12:55am UTC](https://discuss.elastic.co/t/searchresponse-as-json/20335/2 "2017-07-06T00:55:04Z")

</div>


