# Indexing compressed (gzip) content into Elastic through Java APIs

**URL:** <https://discuss.elastic.co/t/indexing-compressed-gzip-content-into-elastic-through-java-apis/74102>\
**Category:** Elasticsearch\
**Created:** [February 6, 2017, 5:45pm UTC](https://discuss.elastic.co/t/indexing-compressed-gzip-content-into-elastic-through-java-apis/74102 "2017-02-06T17:45:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasons-tlr](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jasons-tlr](https://discuss.elastic.co/u/jasons-tlr)\
**Post date:** [February 6, 2017, 5:45pm UTC](https://discuss.elastic.co/t/indexing-compressed-gzip-content-into-elastic-through-java-apis/74102/1 "2017-02-06T17:45:50Z")

</div>

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 thoughts on how to actually do this?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 6, 2017, 6:08pm UTC](https://discuss.elastic.co/t/indexing-compressed-gzip-content-into-elastic-through-java-apis/74102/2 "2017-02-06T18:08:05Z")

</div>

What would the zip contain ?

---

<div class="post-metadata">

**Author:** ![jasons-tlr](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jasons-tlr](https://discuss.elastic.co/u/jasons-tlr)\
**Post date:** [February 6, 2017, 6:13pm UTC](https://discuss.elastic.co/t/indexing-compressed-gzip-content-into-elastic-through-java-apis/74102/3 "2017-02-06T18:13:23Z")

</div>

The zip would contain JSON documents.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 6, 2017, 6:25pm UTC](https://discuss.elastic.co/t/indexing-compressed-gzip-content-into-elastic-through-java-apis/74102/4 "2017-02-06T18:25:22Z")

</div>

May be logstash could help?

But really why not sending a bulk of all your json docs?

---

<div class="post-metadata">

**Author:** ![jasons-tlr](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jasons-tlr](https://discuss.elastic.co/u/jasons-tlr)\
**Post date:** [February 7, 2017, 1:04pm UTC](https://discuss.elastic.co/t/indexing-compressed-gzip-content-into-elastic-through-java-apis/74102/5 "2017-02-07T13:04:59Z")

</div>

Thank you.

The logstash idea is great; I will take a look.

With regards to the bulk loading of JSON. is it possible to bulk load a GZIP (of JSON documents)?

---

<div class="post-metadata">

**Author:** ![jasons-tlr](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jasons-tlr](https://discuss.elastic.co/u/jasons-tlr)\
**Post date:** [February 7, 2017, 1:18pm UTC](https://discuss.elastic.co/t/indexing-compressed-gzip-content-into-elastic-through-java-apis/74102/6 "2017-02-07T13:18:41Z")

</div>

Quick follow-up. I just got a GZip of JSON documents to load through the BULK API. Thank you for your help.

---

<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:** [March 7, 2017, 1:19pm UTC](https://discuss.elastic.co/t/indexing-compressed-gzip-content-into-elastic-through-java-apis/74102/7 "2017-03-07T13:19:04Z")

</div>

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