Converting bytes to SearchResponse


I am working on a network streaming application and also works as a thin proxy server on top of elasticsearch. The application basically does is query on the ES cluster and then streams the response to a client application.

            XContentBuilder xContentBuilder = XContentFactory.jsonBuilder();
            response.toXContent(xContentBuilder, ToXContent.EMPTY_PARAMS);

bytes[] responseStreamBytes = xContentBuilder.bytes().toBytes();

The client side application should do is get the stream and convert the bytes array stream to SearchResponse again.
How can this be done ?

i have done is use yse readFrom from SearchResponse class. However, it gives a error like Can't read unknown type [121]
at org.elasticsearch.transport.TransportMessage.readFrom(
at org.elasticsearch.action.ActionResponse.readFrom(

(system) #2

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