Tuesday, 25 April 2017

node js elasticsearch requests with compression headers are rejected

I'm using node js elasticsearch library and I'm indexing items. I'm trying to compress the traffic to Elasticsearch by adding a gzip header like so:

    elasticClient.index({
        body: body,
        index: index,
        type: type,
        id: id,
        headers: {
            'Content-Encoding': 'gzip'
        }
    }, function (err, resp) {

    });

Without the gzip header the request works fine, but when I include it I get a socket hang up. I've read that there is an elasticsearch configuration http.compression: true, but if I understood correctly, it refers to compression of ES responses and not to requests. Is there anything I can do to compress my requests? Thanks.



via Mister_L

No comments:

Post a Comment