# ElasticSearch 0.90 fails when "highlight" contains a field of type "long"

**URL:** <https://discuss.elastic.co/t/elasticsearch-0-90-fails-when-highlight-contains-a-field-of-type-long/12480>\
**Category:** Elasticsearch\
**Created:** [June 19, 2013, 2:59pm UTC](https://discuss.elastic.co/t/elasticsearch-0-90-fails-when-highlight-contains-a-field-of-type-long/12480 "2013-06-19T14:59:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guillermo\_Arias\_del\_](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@Guillermo\_Arias\_del\_](https://discuss.elastic.co/u/Guillermo_Arias_del_)\
**Post date:** [June 19, 2013, 2:59pm UTC](https://discuss.elastic.co/t/elasticsearch-0-90-fails-when-highlight-contains-a-field-of-type-long/12480/1 "2013-06-19T14:59:32Z")

</div>

Hi!

We are migrating from ES 0.20.6 to 0.90 and we found the following problem:  
If the "highlight" section of a searh query contains a field of type  
"long", an error occurs. That didn't happen with the old version.  
This is a sample script I used to test this behaviour:

curl -s -o /dev/null -X DELETE "http://${hostname}:9200/test?pretty"

curl -s -o /dev/null -X PUT "http://${hostname}:9200/test/?pretty" -d '  
{  
"mappings" : {  
"test1" : {  
"properties" : {  
"text" : {  
"store": "yes",  
"type": "string"  
}  
}  
},  
"test2" : {  
"properties" : {  
"text" : {  
"store": "yes",  
"type": "string"  
},  
"number" : {  
"store": "yes",  
"type": "long"  
}  
}  
}  
}  
}  
'

curl -s -o /dev/null -X POST "http://${hostname}:9200/test/test1?pretty" -d  
'  
{  
"text" : "test one"  
}  
'

curl -s -o /dev/null -X POST "http://${hostname}:9200/test/test2?pretty" -d  
'  
{  
"text" : "test two",  
"number" : 100  
}  
'

curl -s -o /dev/null -X POST "http://${hostname}:9200/test1/\_refresh"  
curl -s -o /dev/null -X POST "http://${hostname}:9200/test2/\_refresh"

sleep 3

curl -s -X GET "http://${hostname}:9200/test/\_search?pretty" -d '  
{  
"query": {  
"prefix": {  
"text": "test"  
}  
},  
"highlight": {  
"number\_of\_fragments": 0,  
"fields": {  
"text": {},  
"number": {}  
}  
}

}'

If you run it against an elasticsearch 0.20.6 server, it returns the two  
hits, correctly highlighted.  
However, if you run it against an elasticsearch 0.90 server, this happens:

{  
"took" : 6,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 4,  
"failed" : 1,  
"failures" : [ {  
"index" : "test",  
"shard" : 0,  
"status" : 500,  
"reason" : "_FetchPhaseExecutionException_[[test][0]:  
query[text:test\*],from[0],size[10]: Fetch Failed [Failed to highlight field  
[number]]]; nested: StringIndexOutOfBoundsException[String index out of  
range: -1]; "  
} ]  
},  
"hits" : {  
"total" : 2,  
"max\_score" : 1.0,  
"hits" : [ {  
"\_index" : "test",  
"\_type" : "test1",  
"\_id" : "y51XzuuaQ6uYnigzhq5EtA",  
"\_score" : 1.0, "\_source" :  
{  
"text" : "test one"  
}  
,  
"highlight" : {  
"text" : ["_test_ one"]  
}  
} ]  
}  
}

Can anybody tell me why this happens? Thanks in advance!

Guillermo Arias del Río.

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![simonw\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simonw_2/32/1130_2.png) [@simonw\_2](https://discuss.elastic.co/u/simonw_2)\
**Post date:** [June 20, 2013, 7:56am UTC](https://discuss.elastic.co/t/elasticsearch-0-90-fails-when-highlight-contains-a-field-of-type-long/12480/2 "2013-06-20T07:56:58Z")

</div>

can you open an issue for this?

simon

On Wednesday, June 19, 2013 4:59:32 PM UTC+2, Guillermo Arias del Río wrote:

> Hi!
> 
> We are migrating from ES 0.20.6 to 0.90 and we found the following  
> problem: If the "highlight" section of a searh query contains a field of  
> type "long", an error occurs. That didn't happen with the old version.  
> This is a sample script I used to test this behaviour:
> 
> curl -s -o /dev/null -X DELETE "http://${hostname}:9200/test?pretty"
> 
> curl -s -o /dev/null -X PUT "http://${hostname}:9200/test/?pretty" -d '  
> {  
> "mappings" : {  
> "test1" : {  
> "properties" : {  
> "text" : {  
> "store": "yes",  
> "type": "string"  
> }  
> }  
> },  
> "test2" : {  
> "properties" : {  
> "text" : {  
> "store": "yes",  
> "type": "string"  
> },  
> "number" : {  
> "store": "yes",  
> "type": "long"  
> }  
> }  
> }  
> }  
> }  
> '
> 
> curl -s -o /dev/null -X POST "http://${hostname}:9200/test/test1?pretty"  
> -d '  
> {  
> "text" : "test one"  
> }  
> '
> 
> curl -s -o /dev/null -X POST "http://${hostname}:9200/test/test2?pretty"  
> -d '  
> {  
> "text" : "test two",  
> "number" : 100  
> }  
> '
> 
> curl -s -o /dev/null -X POST "http://${hostname}:9200/test1/\_refresh"  
> curl -s -o /dev/null -X POST "http://${hostname}:9200/test2/\_refresh"
> 
> sleep 3
> 
> curl -s -X GET "http://${hostname}:9200/test/\_search?pretty" -d '  
> {  
> "query": {  
> "prefix": {  
> "text": "test"  
> }  
> },  
> "highlight": {  
> "number\_of\_fragments": 0,  
> "fields": {  
> "text": {},  
> "number": {}  
> }  
> }
> 
> }'
> 
> If you run it against an elasticsearch 0.20.6 server, it returns the two  
> hits, correctly highlighted.  
> However, if you run it against an elasticsearch 0.90 server, this happens:
> 
> {  
> "took" : 6,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 4,  
> "failed" : 1,  
> "failures" : [ {  
> "index" : "test",  
> "shard" : 0,  
> "status" : 500,  
> "reason" : "_FetchPhaseExecutionException_[[test][0]:  
> query[text:test\*],from[0],size[10]: Fetch Failed [Failed to highlight field  
> [number]]]; nested: StringIndexOutOfBoundsException[String index out of  
> range: -1]; "  
> } ]  
> },  
> "hits" : {  
> "total" : 2,  
> "max\_score" : 1.0,  
> "hits" : [ {  
> "\_index" : "test",  
> "\_type" : "test1",  
> "\_id" : "y51XzuuaQ6uYnigzhq5EtA",  
> "\_score" : 1.0, "\_source" :  
> {  
> "text" : "test one"  
> }  
> ,  
> "highlight" : {  
> "text" : ["_test_ one"]  
> }  
> } ]  
> }  
> }
> 
> Can anybody tell me why this happens? Thanks in advance!
> 
> Guillermo Arias del Río.

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Guillermo\_Arias\_del\_](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@Guillermo\_Arias\_del\_](https://discuss.elastic.co/u/Guillermo_Arias_del_)\
**Post date:** [June 20, 2013, 8:14am UTC](https://discuss.elastic.co/t/elasticsearch-0-90-fails-when-highlight-contains-a-field-of-type-long/12480/3 "2013-06-20T08:14:54Z")

</div>

OK, done

On Thursday, June 20, 2013 9:56:58 AM UTC+2, simonw wrote:

> can you open an issue for this?
> 
> simon
> 
> On Wednesday, June 19, 2013 4:59:32 PM UTC+2, Guillermo Arias del Río  
> wrote:
> 
> > Hi!
> > 
> > We are migrating from ES 0.20.6 to 0.90 and we found the following  
> > problem: If the "highlight" section of a searh query contains a field of  
> > type "long", an error occurs. That didn't happen with the old version.  
> > This is a sample script I used to test this behaviour:
> > 
> > curl -s -o /dev/null -X DELETE "http://${hostname}:9200/test?pretty"
> > 
> > curl -s -o /dev/null -X PUT "http://${hostname}:9200/test/?pretty" -d '  
> > {  
> > "mappings" : {  
> > "test1" : {  
> > "properties" : {  
> > "text" : {  
> > "store": "yes",  
> > "type": "string"  
> > }  
> > }  
> > },  
> > "test2" : {  
> > "properties" : {  
> > "text" : {  
> > "store": "yes",  
> > "type": "string"  
> > },  
> > "number" : {  
> > "store": "yes",  
> > "type": "long"  
> > }  
> > }  
> > }  
> > }  
> > }  
> > '
> > 
> > curl -s -o /dev/null -X POST "http://${hostname}:9200/test/test1?pretty"  
> > -d '  
> > {  
> > "text" : "test one"  
> > }  
> > '
> > 
> > curl -s -o /dev/null -X POST "http://${hostname}:9200/test/test2?pretty"  
> > -d '  
> > {  
> > "text" : "test two",  
> > "number" : 100  
> > }  
> > '
> > 
> > curl -s -o /dev/null -X POST "http://${hostname}:9200/test1/\_refresh"  
> > curl -s -o /dev/null -X POST "http://${hostname}:9200/test2/\_refresh"
> > 
> > sleep 3
> > 
> > curl -s -X GET "http://${hostname}:9200/test/\_search?pretty" -d '  
> > {  
> > "query": {  
> > "prefix": {  
> > "text": "test"  
> > }  
> > },  
> > "highlight": {  
> > "number\_of\_fragments": 0,  
> > "fields": {  
> > "text": {},  
> > "number": {}  
> > }  
> > }
> > 
> > }'
> > 
> > If you run it against an elasticsearch 0.20.6 server, it returns the two  
> > hits, correctly highlighted.  
> > However, if you run it against an elasticsearch 0.90 server, this happens:
> > 
> > {  
> > "took" : 6,  
> > "timed\_out" : false,  
> > "\_shards" : {  
> > "total" : 5,  
> > "successful" : 4,  
> > "failed" : 1,  
> > "failures" : [ {  
> > "index" : "test",  
> > "shard" : 0,  
> > "status" : 500,  
> > "reason" : "_FetchPhaseExecutionException_[[test][0]:  
> > query[text:test\*],from[0],size[10]: Fetch Failed [Failed to highlight field  
> > [number]]]; nested: StringIndexOutOfBoundsException[String index out of  
> > range: -1]; "  
> > } ]  
> > },  
> > "hits" : {  
> > "total" : 2,  
> > "max\_score" : 1.0,  
> > "hits" : [ {  
> > "\_index" : "test",  
> > "\_type" : "test1",  
> > "\_id" : "y51XzuuaQ6uYnigzhq5EtA",  
> > "\_score" : 1.0, "\_source" :  
> > {  
> > "text" : "test one"  
> > }  
> > ,  
> > "highlight" : {  
> > "text" : ["_test_ one"]  
> > }  
> > } ]  
> > }  
> > }
> > 
> > Can anybody tell me why this happens? Thanks in advance!
> > 
> > Guillermo Arias del Río.

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:30am UTC](https://discuss.elastic.co/t/elasticsearch-0-90-fails-when-highlight-contains-a-field-of-type-long/12480/4 "2017-07-06T02:30:15Z")

</div>


