# Restore the old behavior for SearchResponse in Elasticsearch 8

**URL:** <https://discuss.elastic.co/t/restore-the-old-behavior-for-searchresponse-in-elasticsearch-8/328678>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [March 28, 2023, 7:00am UTC](https://discuss.elastic.co/t/restore-the-old-behavior-for-searchresponse-in-elasticsearch-8/328678 "2023-03-28T07:00:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emanuel\_Zienecker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emanuel_zienecker/32/77580_2.png) [@Emanuel\_Zienecker](https://discuss.elastic.co/u/Emanuel_Zienecker)\
**Post date:** [March 28, 2023, 7:00am UTC](https://discuss.elastic.co/t/restore-the-old-behavior-for-searchresponse-in-elasticsearch-8/328678/1 "2023-03-28T07:00:21Z")

</div>

Due to missing compatibility with the GeoBoundingBox query I am forced to use ad-hoc the new Elasticsearch 8 Java client. According to the documentation, when using the search, a document class must now be specified that will be used for deseralization.  
In the old search, a simple map with Key (String) Value (Any) was returned at this point.

How can I restore this behavior? We are using search across multiple entities, so we can't apply a specific type such as "Product" to the search result. Besides JsonNode/ObjectNode I had tried to follow Jackson and use something like this:

`val searchResponse = elasticsearchClient.search(searchRequest, object : TypeReference<Map<String, Any?>>(){}::class.java)`

But with this I get the following error message:

`com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "name" (class com.test.test.elasticsearch.QueryService$geoBoundingBoxQuery$searchResponsey$1), not marked as ignorable (0 known properties: ])`

What do I do to recover the behavior from the old Java client?

---

<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:** [April 25, 2023, 7:01am UTC](https://discuss.elastic.co/t/restore-the-old-behavior-for-searchresponse-in-elasticsearch-8/328678/2 "2023-04-25T07:01:10Z")

</div>

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