# Highlighting offset exception on 1 shard (of 5). Bad chars?

**URL:** <https://discuss.elastic.co/t/highlighting-offset-exception-on-1-shard-of-5-bad-chars/22537>\
**Category:** Elasticsearch\
**Created:** [March 5, 2015, 8:41pm UTC](https://discuss.elastic.co/t/highlighting-offset-exception-on-1-shard-of-5-bad-chars/22537 "2015-03-05T20:41:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kairos](https://avatars.discourse-cdn.com/v4/letter/k/ecc23a/32.png) [@Kairos](https://discuss.elastic.co/u/Kairos)\
**Post date:** [March 5, 2015, 8:41pm UTC](https://discuss.elastic.co/t/highlighting-offset-exception-on-1-shard-of-5-bad-chars/22537/1 "2015-03-05T20:41:05Z")

</div>

I have a query on parents and children that should perform the "highlighting" on some fields.

When I run the query (250 docs) there is no problem as long as the size is lower than a certain number (in this case 84).  
When setting bigger than 84, or just setting "from":84 and "size":1, then I get an error on a shard that prevents the highlighting to be performed correctly.

# ====================================== { "took": 45, "timed\_out": false, "\_shards": { "total": 5, "successful": 4, "failed": 1, "failures": [{ "index": "index\_parent\_child", "shard": 0, "status": 500, "reason": "FetchPhaseExecutionException[[index\_parent\_child][0]: query[filtered((((content:arbeit content:arbeit) | (description:arbeit description:arbeit) | (item\_nr:arbeit item\_nr:arbeit) | (code:arbeit code:arbeit)) child\_filter[file/item](filtered(content:arbeit content:arbeit)-\>cache(\_type:file)) parent\_filter[item](filtered(((description:arbeit description:arbeit) | (item\_nr:arbeit item\_nr:arbeit) | (code:arbeit code:arbeit)))-\>cache(\_type:item)))~1)-\>cache(\_type:file \_type:item)],from[84],size[1]: Fetch Failed [Failed to highlight field [description]]]; nested: InvalidTokenOffsetsException[Token l-ops exceeds length of provided text sized 93]; " } ] }, "hits": { "total": 367, "max\_score": 2.6496673, "hits": [] } }

I think that the problem is cause the content into the fields is in German and that somewhere the multi bytes characters are not managed well, ending into the Exception.

I just tried to reduce the query just to the item, removing the highlighting (so that it could execute with success and show me the interested document) and I got that its "description" field (where it fails) has this content:

# ====================================== "Medizintechnik / Arbeitstisch- und Schrankanlagen /\r\nSanierung und Erneuerung des Zentral-OPs"

In this case it seems there is no multibyte character (umlaut oder scharfen-S). So I suspect the fault is of those "carriage return" and "new line".

Do you know:

- 
  1. if this is a bug in Lucene?

- 
  1. how could I solve the problem?

Thank you all

---

<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, 12:28am UTC](https://discuss.elastic.co/t/highlighting-offset-exception-on-1-shard-of-5-bad-chars/22537/2 "2017-07-06T00:28:17Z")

</div>


