StringIndexOutOfBounds Error from vectorhighlight in our ES(v1.7.1) server debug message

Hi everyone,

I noticed there were lots of StringIndexOutOfBoundsException from vectorhighlight in our elastic search server log like below. Do you have any idea? thanks.

ES version

"version" : {
    "number" : "1.7.1",
    "build_hash" : "b88f43fc40b0bcd7f173a1f9ee2e97816de80b19",
    "build_timestamp" : "2015-07-29T09:54:16Z",
    "build_snapshot" : false,
    "lucene_version" : "4.10.4"
  }

Error

org.elasticsearch.search.fetch.FetchPhaseExecutionException: [myindex][1]: query[filtered(function score (filtered((((+name:cl +name:s)^2.0) | (+autocomp:cl +autocomp:s)))->...,from[0],size[20]: Fetch Failed [Failed to highlight field [content]]
                at org.elasticsearch.search.highlight.FastVectorHighlighter.highlight(FastVectorHighlighter.java:177)
                at org.elasticsearch.search.highlight.HighlightPhase.hitExecute(HighlightPhase.java:133)
                at org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:194)
                at org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:516)
                at org.elasticsearch.search.action.SearchServiceTransportAction$17.call(SearchServiceTransportAction.java:452)
                at org.elasticsearch.search.action.SearchServiceTransportAction$17.call(SearchServiceTransportAction.java:449)
                at org.elasticsearch.search.action.SearchServiceTransportAction$23.run(SearchServiceTransportAction.java:559)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
                at java.lang.Thread.run(Thread.java:745)
        Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 61
                at java.lang.String.substring(String.java:1907)
                at org.apache.lucene.search.vectorhighlight.BaseFragmentsBuilder.makeFragment(BaseFragmentsBuilder.java:178)
                at org.elasticsearch.search.highlight.vectorhighlight.SimpleFragmentsBuilder.makeFragment(SimpleFragmentsBuilder.java:43)
                at org.apache.lucene.search.vectorhighlight.BaseFragmentsBuilder.createFragments(BaseFragmentsBuilder.java:144)
                at org.apache.lucene.search.vectorhighlight.FastVectorHighlighter.getBestFragments(FastVectorHighlighter.java:187)
                at org.elasticsearch.search.highlight.FastVectorHighlighter.highlight(FastVectorHighlighter.java:154)
                ... 9 more

Thanks,
Cheng

This looks like a bug in Lucene, the full-text search library that ES uses. It might have been fixed in newer versions though. I suggest upgrading to ES 2.3.4 if possible.