I'm writing a thin proxy server to sit in front of ElasticSearch,
using the java client API. The proxy constructs a query, sends it off
to ElasticSearch, and returns the results to the proxy client.
Pretty simple, but I'm struggling with how to take the SearchResponse
and get it to stream itself as JSON to the proxy's HTTP response. The
ToXContent and Streamable interfaces seem to only work with low-level
data, not JSON. The cloest I can get to is
... but of course, this writes gibberish to the stream, nut human-
Am I looking in the wrong place?
I'm considering using the REST client inside the proxy instead, but it
seems a shame to forgo the extra performance of the Java Node client,
given that the proxy is written in Java.