# Lucene style range query string throws an error

**URL:** <https://discuss.elastic.co/t/lucene-style-range-query-string-throws-an-error/3666>\
**Category:** Elasticsearch\
**Created:** [December 15, 2010, 7:48am UTC](https://discuss.elastic.co/t/lucene-style-range-query-string-throws-an-error/3666 "2010-12-15T07:48:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mr\_ow\_bot](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@mr\_ow\_bot](https://discuss.elastic.co/u/mr_ow_bot)\
**Post date:** [December 15, 2010, 7:48am UTC](https://discuss.elastic.co/t/lucene-style-range-query-string-throws-an-error/3666/1 "2010-12-15T07:48:17Z")

</div>

Hi,

I'm new to elastic search, are lucene style query strings supposed to  
work?

I'm executing queries in Java like this:

client.prepareSearch(indexName).setQuery(queryString(searchString)).execute().actionGet().hits();

the JSON is indexed like this:

client.prepareIndex().setContentType(XContentType.JSON).setIndex(indexName).setId(id).setType(type).setSource(jsonString).execute().actionGet();

and the json objects I am indexing look like this:

{  
"key" : "kiwi",  
"maximum" : 2500000,  
"alertLevel" : 80.0,  
"amountTaken" : 64550,  
"amountTakenPercent" : 2.58200,  
"auditLogEntries" : [ {  
"auditInfo" : {  
"user" : "mr ow bot",  
"tool" : "xxx",  
"updateTime" : "2010-12-15T15:41:04.112+08:00"  
},  
"operation" : "CREATE\_RESERVATION",  
"parameters" : ["id1", "64550"]  
} ],  
"currentReservationAmountsById" : {  
"id1" : 64550  
},  
"oldReservationAmountsById" : {  
}  
}

The search string "alertLevel:80.0" works and returns results but  
"alertLevel:[70.0 to 90.0]" doesn't and actually throws:

Caused by:  
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed  
to execute phase [query], total failure; shardFailures {null:  
ArrayIndexOutOfBoundsException[68]}{null:  
ArrayIndexOutOfBoundsException[68]}{null:  
ArrayIndexOutOfBoundsException[68]}{null:  
ArrayIndexOutOfBoundsException[68]}{null:  
ArrayIndexOutOfBoundsException[68]}  
at org.elasticsearch.action.search.type.TransportSearchTypeAction  
$BaseAsyncAction.onFirstPhaseResult(TransportSearchTypeAction.java:  
251)  
at org.elasticsearch.action.search.type.TransportSearchTypeAction  
$BaseAsyncAction.access$200(TransportSearchTypeAction.java:77)  
at org.elasticsearch.action.search.type.TransportSearchTypeAction  
$BaseAsyncAction$3.onFailure(TransportSearchTypeAction.java:197)  
at  
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:  
134)  
at  
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction  
$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:  
76)  
at org.elasticsearch.action.search.type.TransportSearchTypeAction  
$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)  
at org.elasticsearch.action.search.type.TransportSearchTypeAction  
$BaseAsyncAction.access$000(TransportSearchTypeAction.java:77)  
at org.elasticsearch.action.search.type.TransportSearchTypeAction  
$BaseAsyncAction$2.run(TransportSearchTypeAction.java:168)  
at java.util.concurrent.ThreadPoolExecutor  
$Worker.runTask(ThreadPoolExecutor.java:886)  
at java.util.concurrent.ThreadPoolExecutor  
$Worker.run(ThreadPoolExecutor.java:908)  
at java.lang.Thread.run(Thread.java:619)

Am I doing it wrong? Is there a way to do range based queries using  
query strings (it's just a big search box on the front end, so query  
strings are preferable)?

Cheers,

Mike.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [December 16, 2010, 4:01pm UTC](https://discuss.elastic.co/t/lucene-style-range-query-string-throws-an-error/3666/2 "2010-12-16T16:01:07Z")

</div>

try and do [70 TO 90] (uppercase TO).

On Wed, Dec 15, 2010 at 9:48 AM, mr ow bot [mike.rowbotham@gmail.com](mailto:mike.rowbotham@gmail.com) wrote:

> Hi,
> 
> I'm new to Elasticsearch, are lucene style query strings supposed to  
> work?
> 
> I'm executing queries in Java like this:
> 
> client.prepareSearch(indexName).setQuery(queryString(searchString)).execute().actionGet().hits();
> 
> the JSON is indexed like this:
> 
> client.prepareIndex().setContentType(XContentType.JSON).setIndex(indexName).setId(id).setType(type).setSource(jsonString).execute().actionGet();
> 
> and the json objects I am indexing look like this:
> 
> {  
> "key" : "kiwi",  
> "maximum" : 2500000,  
> "alertLevel" : 80.0,  
> "amountTaken" : 64550,  
> "amountTakenPercent" : 2.58200,  
> "auditLogEntries" : [ {  
> "auditInfo" : {  
> "user" : "mr ow bot",  
> "tool" : "xxx",  
> "updateTime" : "2010-12-15T15:41:04.112+08:00"  
> },  
> "operation" : "CREATE\_RESERVATION",  
> "parameters" : ["id1", "64550"]  
> } ],  
> "currentReservationAmountsById" : {  
> "id1" : 64550  
> },  
> "oldReservationAmountsById" : {  
> }  
> }
> 
> The search string "alertLevel:80.0" works and returns results but  
> "alertLevel:[70.0 to 90.0]" doesn't and actually throws:
> 
> Caused by:  
> org.elasticsearch.action.search.SearchPhaseExecutionException: Failed  
> to execute phase [query], total failure; shardFailures {null:  
> ArrayIndexOutOfBoundsException[68]}{null:  
> ArrayIndexOutOfBoundsException[68]}{null:  
> ArrayIndexOutOfBoundsException[68]}{null:  
> ArrayIndexOutOfBoundsException[68]}{null:  
> ArrayIndexOutOfBoundsException[68]}  
> at org.elasticsearch.action.search.type.TransportSearchTypeAction  
> $BaseAsyncAction.onFirstPhaseResult(TransportSearchTypeAction.java:  
> 251)  
> at org.elasticsearch.action.search.type.TransportSearchTypeAction  
> $BaseAsyncAction.access$200(TransportSearchTypeAction.java:77)  
> at org.elasticsearch.action.search.type.TransportSearchTypeAction  
> $BaseAsyncAction$3.onFailure(TransportSearchTypeAction.java:197)  
> at
> 
> org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:  
> 134)  
> at  
> org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction
> 
> $AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:  
> 76)  
> at org.elasticsearch.action.search.type.TransportSearchTypeAction  
> $BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)  
> at org.elasticsearch.action.search.type.TransportSearchTypeAction  
> $BaseAsyncAction.access$000(TransportSearchTypeAction.java:77)  
> at org.elasticsearch.action.search.type.TransportSearchTypeAction  
> $BaseAsyncAction$2.run(TransportSearchTypeAction.java:168)  
> at java.util.concurrent.ThreadPoolExecutor  
> $Worker.runTask(ThreadPoolExecutor.java:886)  
> at java.util.concurrent.ThreadPoolExecutor  
> $Worker.run(ThreadPoolExecutor.java:908)  
> at java.lang.Thread.run(Thread.java:619)
> 
> Am I doing it wrong? Is there a way to do range based queries using  
> query strings (it's just a big search box on the front end, so query  
> strings are preferable)?
> 
> Cheers,
> 
> Mike.

---

<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, 4:15am UTC](https://discuss.elastic.co/t/lucene-style-range-query-string-throws-an-error/3666/3 "2017-07-06T04:15:14Z")

</div>


