Restore the old behavior for SearchResponse in Elasticsearch 8

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 =, object : TypeReference<Map<String, Any?>>(){}

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?

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