# Java REST client: gzip/compress request

**URL:** <https://discuss.elastic.co/t/java-rest-client-gzip-compress-request/231031>\
**Category:** Elasticsearch\
**Created:** [May 4, 2020, 8:17pm UTC](https://discuss.elastic.co/t/java-rest-client-gzip-compress-request/231031 "2020-05-04T20:17:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![karussell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karussell/32/4823_2.png) [@karussell](https://discuss.elastic.co/u/karussell)\
**Post date:** [May 4, 2020, 8:17pm UTC](https://discuss.elastic.co/t/java-rest-client-gzip-compress-request/231031/1 "2020-05-04T20:17:11Z")

</div>

There is not much documentation about how to compress a request - only this unanswered topic: [Java REST client, GZIP compressed request](https://discuss.elastic.co/t/java-rest-client-gzip-compressed-request/98350)

On the issue tracker there are several recent issues about how to handle gzipped responses, but I need to compress an index bulk request that includes several documents (\>50). I'm using the low level client. Should I compress the content and additionally use GzipCompressingEntity? What about the header? Should I set `Content-Encoding` to `gzip`? It seems the underlying apache client supports this out of the box, is the same available for the Elasticsearch client?

Or how is it usually done to efficiently pipe lots of documents from a Java application into Elasticsearch?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 1, 2020, 8:17pm UTC](https://discuss.elastic.co/t/java-rest-client-gzip-compress-request/231031/2 "2020-06-01T20:17:12Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
