Getting 500 error in es5.0.0

string_index_out_of_bounds_exception

I'm experimenting with moving my app to ES5 (though probably won't do so for real until it is a bit more mature).

The first scroll query it does with more than "size" results gives an error, which I can't account for in my code. The initial request for a scrolled search yields the 250 results I asked for, but the second gets a 500 error.

The initial request is a POST (and "current" is, of course, the type)
.../myindex/current/_search/?scroll=10s
{"query":{"match_all":{}},"_source":["membershipnumber","membershiptype","address.districtward","address.countydivision","expirydate","joined","paymentmethod","deliverymethod","deliveryround","deliverycopies","giftaiddeclaration.on","individuals"],"size":250,"sort":["_doc"]}

The second batch of results is (abbreviated a little):
.../_search/scroll/: {"scroll":"60s","scroll_id":"DX...Q=="}

and it returns:
"error" : {
"root_cause" : [
{
"type" : "string_index_out_of_bounds_exception",
"reason" : "String index out of range: 0"
}
],
"type" : "string_index_out_of_bounds_exception",
"reason" : "String index out of range: 0"
},
"status" : 500
}

This code works in es2.4, though I have been through and changed all my mappings to account for the string type changes (and reloaded all the data - why the gratuitous change not to allow POST for index creation when you can use POST everywhere else!? That broke my restore scripts.) and also reworked all my and/or queries to bool (changes which seem ok in 2.4)

The other issue might be that I cam using OpenJDK (which I updated to the most recent version available, OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-2~bpo8+1-b14)
OpenJDK 64-Bit Server VM (build 25.111-b14, mixed mode)). I do not (think I) have the option to use Sun Java as this is an ARM processor. But you do say "Elasticsearch will refuse to start if a known-bad version of Java is used."

The log file shows:
[2016-11-06T18:29:08,029][WARN ][r.suppressed ] path: //_search/scroll/, params: {pretty=, index=, id=scroll, type=_search}
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:658) ~[?:1.8.0_111]
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.validateIndexName(MetaDataCreateIndexService.java:146) ~[elasticsearch-5.0.0.jar:5.0.0]
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.validate(MetaDataCreateIndexService.java:477) ~[elasticsearch-5.0.0.jar:5.0.0]
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.access$000(MetaDataCreateIndexService.java:103) ~[elasticsearch-5.0.0.jar:5.0.0]
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$1.execute(MetaDataCreateIndexService.java:223) ~[elasticsearch-5.0.0.jar:5.0.0]
at org.elasticsearch.cluster.ClusterStateUpdateTask.execute(ClusterStateUpdateTask.java:45) ~[elasticsearch-5.0.0.jar:5.0.0]
at org.elasticsearch.cluster.service.ClusterService.runTasksForExecutor(ClusterService.java:555) [elasticsearch-5.0.0.jar:5.0.0]
at org.elasticsearch.cluster.service.ClusterService$UpdateTask.run(ClusterService.java:894) [elasticsearch-5.0.0.jar:5.0.0]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:444) [elasticsearch-5.0.0.jar:5.0.0]
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:237) [elasticsearch-5.0.0.jar:5.0.0]
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:200) [elasticsearch-5.0.0.jar:5.0.0]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_111]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_111]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]

Hey,

openjdk is just fine, dont worry about it.

I see this in one error message

[2016-11-06T18:29:08,029][WARN ][r.suppressed ] path: //_search/scroll/, params: {pretty=, index=, id=scroll, type=_search}

There are to slashes at the beginning of the URL being //_search.

Can you make sure you remove that double slash and if the error persists, can you file a github issue, please?

Thanks so much!

--Alex

Thanks, you're right, it was that.

This was, of course, because I am using the same code to do all the curl requests, and this is a rare case (indeed, I think apart from index creation, the only one I use) where index is not given so was substituting an empty string when building the URL. This didn't seem to bother earlier versions.

(Still, it would be better if it didn't do a 500 error, but I can see why it might get upset).

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.