# Garbled document with ES 0.19.x with \_source compressed

**URL:** <https://discuss.elastic.co/t/garbled-document-with-es-0-19-x-with--source-compressed/7215>\
**Category:** Elasticsearch\
**Created:** [April 3, 2012, 8:46pm UTC](https://discuss.elastic.co/t/garbled-document-with-es-0-19-x-with--source-compressed/7215 "2012-04-03T20:46:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Craig\_Brown](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@Craig\_Brown](https://discuss.elastic.co/u/Craig_Brown)\
**Post date:** [April 3, 2012, 8:46pm UTC](https://discuss.elastic.co/t/garbled-document-with-es-0-19-x-with--source-compressed/7215/1 "2012-04-03T20:46:21Z")

</div>

I'm hoping this is enough to describe the issue. If not, then I can  
post a gist with more information.

We have an ES 0.19.0 cluster of 4 nodes on AWS with amazon linux. with  
all of our indexes, we have \_source compression enabled. I've noticed  
for some operations with the java api, the \_source document is garbled  
when retrieved from ES. In particular, it looks like (SearchHit)  
hit.sourceAsString() will return a garbled source when new  
String((SearchHit) hit.source()) returns the document fine. Also  
performing a matchall() using curl and the REST api against the index  
will return the document(s) fine.

If I disable \_source compression and reindex the docuements, then I  
don't see any problems with (SearchHit) hit.sourceAsString().  
Upgrading to ES 0.19.1 did not have any effect. I did not see the  
problem with several versions of 0.18.x that we used.

GARBLED  
ZV{"aliases":[],"last\_modified":"26 Jan 2012","source\_datab 3\_i  
"0,"fir 5nam@E"F@ N` P

GOOD  
{"aliases":[],"last\_modified":"26 Jan 2012","source\_database\_id":  
0,"first\_names":"First Names","last\_names":"Last Names","birth\_date":  
{"year":null,"month":null,"day":null},"death\_date":  
...  
}

Thanks!

- Craig

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 3, 2012, 9:44pm UTC](https://discuss.elastic.co/t/garbled-document-with-es-0-19-x-with--source-compressed/7215/2 "2012-04-03T21:44:41Z")

</div>

Its a specific bug with compression enabled and using sourceAsString in the  
Java API, its fixed in 0.19 branch (and upcoming 0.19.2), for now, you can  
do the conversion to string yourself using the source byte array data.

On Tue, Apr 3, 2012 at 11:46 PM, Craig Brown [cbrown@youwho.com](mailto:cbrown@youwho.com) wrote:

> I'm hoping this is enough to describe the issue. If not, then I can  
> post a gist with more information.
> 
> We have an ES 0.19.0 cluster of 4 nodes on AWS with amazon linux. with  
> all of our indexes, we have \_source compression enabled. I've noticed  
> for some operations with the java api, the \_source document is garbled  
> when retrieved from ES. In particular, it looks like (SearchHit)  
> hit.sourceAsString() will return a garbled source when new  
> String((SearchHit) hit.source()) returns the document fine. Also  
> performing a matchall() using curl and the REST api against the index  
> will return the document(s) fine.
> 
> If I disable \_source compression and reindex the docuements, then I  
> don't see any problems with (SearchHit) hit.sourceAsString().  
> Upgrading to ES 0.19.1 did not have any effect. I did not see the  
> problem with several versions of 0.18.x that we used.
> 
> GARBLED  
> ZV  {"aliases":,"last\_modified":"2 6 Jan 2012","source\_datab 3 \_i  
> " 0,"fir 5 nam@E "F@ N` P
> 
> GOOD  
> {"aliases":,"last\_modified":"26 Jan 2012","source\_database\_id":  
> 0,"first\_names":"First Names","last\_names":"Last Names","birth\_date":  
> {"year":null,"month":null,"day":null},"death\_date":  
> ...  
> }
> 
> Thanks!
> 
> - Craig

---

<div class="post-metadata">

**Author:** ![Craig\_Brown](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@Craig\_Brown](https://discuss.elastic.co/u/Craig_Brown)\
**Post date:** [April 3, 2012, 10:10pm UTC](https://discuss.elastic.co/t/garbled-document-with-es-0-19-x-with--source-compressed/7215/3 "2012-04-03T22:10:25Z")

</div>

Thanks Shay! already implemented.

- Craig

On Tue, Apr 3, 2012 at 3:44 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> Its a specific bug with compression enabled and using sourceAsString in  
> the Java API, its fixed in 0.19 branch (and upcoming 0.19.2), for now, you  
> can do the conversion to string yourself using the source byte array data.
> 
> On Tue, Apr 3, 2012 at 11:46 PM, Craig Brown [cbrown@youwho.com](mailto:cbrown@youwho.com) wrote:
> 
> > I'm hoping this is enough to describe the issue. If not, then I can  
> > post a gist with more information.
> > 
> > We have an ES 0.19.0 cluster of 4 nodes on AWS with amazon linux. with  
> > all of our indexes, we have \_source compression enabled. I've noticed  
> > for some operations with the java api, the \_source document is garbled  
> > when retrieved from ES. In particular, it looks like (SearchHit)  
> > hit.sourceAsString() will return a garbled source when new  
> > String((SearchHit) hit.source()) returns the document fine. Also  
> > performing a matchall() using curl and the REST api against the index  
> > will return the document(s) fine.
> > 
> > If I disable \_source compression and reindex the docuements, then I  
> > don't see any problems with (SearchHit) hit.sourceAsString().  
> > Upgrading to ES 0.19.1 did not have any effect. I did not see the  
> > problem with several versions of 0.18.x that we used.
> > 
> > GARBLED  
> > ZV  {"aliases":,"last\_modified":"2 6 Jan 2012","source\_datab 3 \_i  
> > " 0,"fir 5 nam@E "F@ N` P
> > 
> > GOOD  
> > {"aliases":,"last\_modified":"26 Jan 2012","source\_database\_id":  
> > 0,"first\_names":"First Names","last\_names":"Last Names","birth\_date":  
> > {"year":null,"month":null,"day":null},"death\_date":  
> > ...  
> > }
> > 
> > Thanks!
> > 
> > - Craig

--  
…  
CRAIG BROWN  
chief architect  
youwho, Inc.

_[www.youwho.com](http://www.youwho.com)_ [http://www.youwho.com/](http://www.youwho.com/)

T: 801.855. 0921  
M: 801.913. 0939

---

<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:** [July 6, 2017, 3:33am UTC](https://discuss.elastic.co/t/garbled-document-with-es-0-19-x-with--source-compressed/7215/4 "2017-07-06T03:33:46Z")

</div>


