# Large string fields

**URL:** <https://discuss.elastic.co/t/large-string-fields/71818>\
**Category:** Elasticsearch\
**Created:** [January 17, 2017, 7:13am UTC](https://discuss.elastic.co/t/large-string-fields/71818 "2017-01-17T07:13:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emrah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emrah/32/17657_2.png) [@Emrah](https://discuss.elastic.co/u/Emrah)\
**Post date:** [January 17, 2017, 7:13am UTC](https://discuss.elastic.co/t/large-string-fields/71818/1 "2017-01-17T07:13:15Z")

</div>

Hi there,

Anyone experienced compressing large strings (gzip or 7zip) and then store it on Elasticsearch or does it make any sense to compress large strings like 100k chars (not \>1 mb) ?

---

<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:** [January 17, 2017, 7:38am UTC](https://discuss.elastic.co/t/large-string-fields/71818/2 "2017-01-17T07:38:10Z")

</div>

Elasticsearch uses compression on stored fields already behind the scene.

---

<div class="post-metadata">

**Author:** ![Emrah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emrah/32/17657_2.png) [@Emrah](https://discuss.elastic.co/u/Emrah)\
**Post date:** [January 17, 2017, 2:37pm UTC](https://discuss.elastic.co/t/large-string-fields/71818/3 "2017-01-17T14:37:36Z")

</div>

Thanks for the answer David. Actually, this question kinda related Elasticsearch and i was wondering if i compress the string and store it, at the run time while doing too much decompress should i be aware of high memory usage in c# or Java ?

---

<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:** [January 17, 2017, 3:47pm UTC](https://discuss.elastic.co/t/large-string-fields/71818/4 "2017-01-17T15:47:25Z")

</div>

So you don't want to search for the fields but just store some compressed content?

You can store a binary content in an elasticsearch field. But you need first to convert it to BASE64 so I'm not sure you really want to do that.

I don't understand what kind of problem you are trying to solve here.

---

<div class="post-metadata">

**Author:** ![Emrah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emrah/32/17657_2.png) [@Emrah](https://discuss.elastic.co/u/Emrah)\
**Post date:** [January 18, 2017, 7:46am UTC](https://discuss.elastic.co/t/large-string-fields/71818/5 "2017-01-18T07:46:25Z")

</div>

Yes, basically i have a document on elastic that i make search on many field and each doc has a text field like "description" and while indexing docs i had some trouble about indexing large string field. So i remove that field from the doc and began to get the text from another data source. In this case, i get the document from elastic but the text. So getting the data from two different data source doesn't make sense to me. Beside Elasticsearch, as a software developer, does it make sense to you that compressing text while indexing and using only ElasticSearch as data source ?

By the way, I apologize for taking your time, related to problem below, should i index only fields that i'll make search on it, or index the whole content and use Elasticsearch as my main data source.

---

<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:** [January 18, 2017, 9:29am UTC](https://discuss.elastic.co/t/large-string-fields/71818/6 "2017-01-18T09:29:42Z")

</div>

So just add your big text field but don't index it with `index: false` in the mapping for this big field.

In that way, elasticsearch will still have the big field as part of the `_source` and `_source` is compressed by 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:** [February 15, 2017, 9:30am UTC](https://discuss.elastic.co/t/large-string-fields/71818/7 "2017-02-15T09:30:10Z")

</div>

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