SearchSourceBuilder and SearchRequestBuilder

Ayup, we are using the Java API with SearchRequestBuilder for building search queries. I'm now adding JEST as an additional client.

The plan is to move the query building to SearchSourceBuilder and then pass that to SearchRequestBuilder meaning the query building logic stays the same for both cliens.

But when using SearchRequestBuilder.setSource() the query is not added. It seems that SearchSourceBuilder has query as its root which SearchRequestBuilder (Suddenly, my SearchRequestBuilder's setSource doesn't work!). I'll have to use SearchRequestBuilder.setExtraBuilder() instead.

But now my query JSON kind of disappears as binary blob inside SearchRequestBuilder and is not shown in toString() etc. This kind of complicates debugging and logging.

Is there a cleaner way to pass SearchSourceBuilder to SearchRequestBuilder without unrolling and manipulating the JSON itself?

-a