From 0469cca4be940f7c243c27dfed3ef484f38baa66 Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Thu, 12 Dec 2013 22:29:54 +0100 Subject: [PATCH] properly support global transport compression with new bytes transport request optimization --- .../org/elasticsearch/transport/netty/NettyTransport.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java b/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java index 1a50c689e10..56aa1044a94 100644 --- a/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java +++ b/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java @@ -542,7 +542,9 @@ public class NettyTransport extends AbstractLifecycleComponent implem BytesStreamOutput bStream = new BytesStreamOutput(); bStream.skip(NettyHeader.HEADER_SIZE); StreamOutput stream = bStream; - if (options.compress()) { + // only compress if asked, and, the request is not bytes, since then only + // the header part is compressed, and the "body" can't be extracted as compressed + if (options.compress() && (!(request instanceof BytesTransportRequest))) { status = TransportStatus.setCompress(status); stream = CompressorFactory.defaultCompressor().streamOutput(stream); }