# Long String retrieved as empty; short String retrieved fine; why ES?

**URL:** https://discuss.elastic.co/t/long-string-retrieved-as-empty-short-string-retrieved-fine-why-es/18840
**Category:** Elasticsearch
**Created:** [July 23, 2014, 7:36pm UTC](https://discuss.elastic.co/t/long-string-retrieved-as-empty-short-string-retrieved-fine-why-es/18840 "2014-07-23T19:36:10Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Adrian\_M](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@Adrian\_M](https://discuss.elastic.co/u/Adrian_M)
#### Post date: [July 23, 2014, 7:36pm UTC](https://discuss.elastic.co/t/long-string-retrieved-as-empty-short-string-retrieved-fine-why-es/18840/1 "2014-07-23T19:36:10Z")

</div>

I use this script to inspect data in various docs from ES.

{  
"query": {  
"match\_all": {}  
},  
"sort": {  
"\_script": {  
"script": "if(doc['site'].values.contains(12)){return  
'foo'}else{return doc['dataX'].values }",  
"type": "string",  
"order": "desc"  
}  
}  
}

The only important part of this script is that it will always go in the  
else clause and print doc['dataX'].values

I also have this document JSON:  
{  
"doc":{  
"site" : "[gencoupe.com](http://gencoupe.com)",  
"name" : "amount-active-users",  
"daily" : {  
"dataX": "1000,490,390,600,300",  
"dataY": "1388538061, 1388624461, 1388710861, 1388797261, 1388883661",  
"startDate":1388538061,  
"endDate":1388883661  
}

}  
}

I've noticed that if the string dataX is longer than 40 someting  
characters, the script I presented retrieves dataX as an empty array. If  
the strnig is 40 chars or less it works fine and retrieves the contents of  
the String.

Is there a limit on how many char a String can store in ES? Why am I seeing  
this inconsistent behaviour and how can I make it retrieve the entire  
string, of potentially very large size?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/39a82d40-3381-4b1f-a5b4-96805b14e90a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/39a82d40-3381-4b1f-a5b4-96805b14e90a%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Adrian\_M](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@Adrian\_M](https://discuss.elastic.co/u/Adrian_M)
#### Post date: [July 23, 2014, 7:49pm UTC](https://discuss.elastic.co/t/long-string-retrieved-as-empty-short-string-retrieved-fine-why-es/18840/2 "2014-07-23T19:49:00Z")

</div>

Correction: I get somewhere around 220 characters in that String NOT 40-50  
as I originally mentioned.

On Wednesday, 23 July 2014 15:36:10 UTC-4, Adrian wrote:

> I use this script to inspect data in various docs from ES.
> 
> {  
> "query": {  
> "match\_all": {}  
> },  
> "sort": {  
> "\_script": {  
> "script": "if(doc['site'].values.contains(12)){return  
> 'foo'}else{return doc['dataX'].values }",  
> "type": "string",  
> "order": "desc"  
> }  
> }  
> }
> 
> The only important part of this script is that it will always go in the  
> else clause and print doc['dataX'].values
> 
> I also have this document JSON:  
> {  
> "doc":{  
> "site" : "[gencoupe.com](http://gencoupe.com)",  
> "name" : "amount-active-users",  
> "daily" : {  
> "dataX": "1000,490,390,600,300",  
> "dataY": "1388538061, 1388624461, 1388710861, 1388797261, 1388883661",  
> "startDate":1388538061,  
> "endDate":1388883661  
> }
> 
> }  
> }
> 
> I've noticed that if the string dataX is longer than 40 someting  
> characters, the script I presented retrieves dataX as an empty array. If  
> the strnig is 40 chars or less it works fine and retrieves the contents of  
> the String.
> 
> Is there a limit on how many char a String can store in ES? Why am I  
> seeing this inconsistent behaviour and how can I make it retrieve the  
> entire string, of potentially very large size?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/045114fe-abfc-4144-8824-a6b312cd22cb%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/045114fe-abfc-4144-8824-a6b312cd22cb%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:13am UTC](https://discuss.elastic.co/t/long-string-retrieved-as-empty-short-string-retrieved-fine-why-es/18840/3 "2017-07-06T01:13:47Z")

</div>


