RestHighLevelClient & http.compression for gzip

Hi ,

Trying to enable http.compression on elasticsearch but the response is not able to parse through handlers on RestHighLevelClient.

Error :

Caused by: com.fasterxml.jackson.core.JsonParseException: Illegal character ((CTRL-CHAR, code 31)): only regular white space (\r, \n, \t) is allowed between tokens

Client is enabled with :

Header defaultHeaders =
new Header {
new BasicHeader(HttpHeaders.ACCEPT_ENCODING, "gzip,deflate"),
new BasicHeader(HttpHeaders.CONTENT_ENCODING, "gzip,deflate")

is there any other configuration, to enable the decompression on the client side with RestHighLevelClient.


as far as I understand you are getting back the gzip response. The problem is that the underlying apache async http client does not support transparent content decompression. That is because there is currently no way to perform in a non blocking fashion, while the whole point of using async client is that it's non-blocking. If you want to use gzip you need to plug in some component to the low-level REST client, hence to the underlying apache http client, to make it perform transparent content decompression. That is not practical though.