Search elasticsearch with java client using JSON query

I don't understand what the need is for using the java api, yet sending json requests that are manually handled. The java api helps sending request and composing them using its own objects. I would recommend to move over to the low level rest client for these cases where json is sent instead.

Query parsing was moved to the coordinating node with 5.0 and the java api must now send parsed objects. I wouldn't recommend doing the parsing on the client side, that is a work-around that may not work in the future. The on thing that should work though is using WrapperQueryBuilder, which allows to provide a query (not the whole search request, only the query part of it) as a string, and its parsing is actually performed on the data nodes rather than on the coordinating node.