# Elasticsearch-rest-high-level-client \_bulk compression

**URL:** <https://discuss.elastic.co/t/elasticsearch-rest-high-level-client-bulk-compression/139290>\
**Category:** Elasticsearch\
**Created:** [July 10, 2018, 7:59am UTC](https://discuss.elastic.co/t/elasticsearch-rest-high-level-client-bulk-compression/139290 "2018-07-10T07:59:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicolas-f](https://avatars.discourse-cdn.com/v4/letter/n/c4cdca/32.png) [@nicolas-f](https://discuss.elastic.co/u/nicolas-f)\
**Post date:** [July 10, 2018, 7:59am UTC](https://discuss.elastic.co/t/elasticsearch-rest-high-level-client-bulk-compression/139290/1 "2018-07-10T07:59:45Z")

</div>

Hi,

We will use the java high level client over a gsm connection. Using ngrep I see that POST content is not compressed. How to enable the compression mechanism in the java rest high level client for index request ?

Thanks,

Best regards

---

<div class="post-metadata">

**Author:** ![nicolas-f](https://avatars.discourse-cdn.com/v4/letter/n/c4cdca/32.png) [@nicolas-f](https://discuss.elastic.co/u/nicolas-f)\
**Post date:** [July 19, 2018, 6:48am UTC](https://discuss.elastic.co/t/elasticsearch-rest-high-level-client-bulk-compression/139290/2 "2018-07-19T06:48:09Z")

</div>

I've found some topics with the same subjects.

> [@Indexing compressed (gzip) content into Elastic through Java APIs](https://discuss.elastic.co/t/indexing-compressed-gzip-content-into-elastic-through-java-apis/74102):
>
> My use cases are within ES 2.4 & 5x; the goal being to feed GZIP content directly into an ES index through my Java application. I'm aware that compressed (GZIP) content can be loaded via the REST end-points, but would like to do this within the Java API when publishing to ES. I have enabled compression on the cluster (http.compression) as well as setting the "Content-Encoding" & "Accept-Encoding" on the request to "gzip", but that does not appear to help. Has anyone had experience, or any tho…

But the issue with the Java Rest Client is related to this issue:

> <https://github.com/elastic/elasticsearch/issues/24349>
>
> Currently it is possible to set a default header in the RestClient that indicate…s that all response should be compressed:
> \`\`\`\`
> "Accept-Encoding": "gzip,deflate"
> \`\`\`\`
> 
> Though the underlying async client that the RestClient uses does not handle compressed content and instead will return a compressed entity. This means that users of RestClient must check the response entity and wrap it with a decompressor if they want to be able to handle compressed responses. 
> Similarly it is not possible to use compression in \`reindex from remote\` since the response entities are not decompressed by the rest client directly. 
> I don't know if the RestClient should do that automatically but we should be able to use compression in \`reindex\` even if this means adding an explicit decompressor in reindex.

---

<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:** [August 16, 2018, 6:48am UTC](https://discuss.elastic.co/t/elasticsearch-rest-high-level-client-bulk-compression/139290/3 "2018-08-16T06:48:13Z")

</div>

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