Range search using lucene syntax


(Jorge Urdaneta) #1

Hi,

I'm trying to support old lucene querys on ElasticSearch. Most querys
just work using QueryBuilders.queryString.
But we can't use range search using the braces syntax.

See my test case: https://gist.github.com/1348031

It throws an ugly exception

Exception in thread "main"
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed
to execute phase [query], total failure; shardFailures
{[99yDqrl_R6aSIin7tLOQpQ][aa][4]: SearchParseException[[aa][4]:
from[-1],size[-1]: Parse Failure [Failed to parse source [na]]];
nested: QueryParsingException[[aa] Failed to parse query [+dd:[10 to
40]]]; nested: ParseException[Cannot parse '+dd:[10 to 40]':
Encountered " <RANGEIN_GOOP> "40 "" at line 1, column 11.
Was expecting:
"]" ...
]; nested: ParseException[Encountered " <RANGEIN_GOOP> "40 "" at
line 1, column 11.
Was expecting:
"]" ...
]; }{[99yDqrl_R6aSIin7tLOQpQ][aa][0]: SearchParseException[[aa]
[0]: from[-1],size[-1]: Parse Failure [Failed to parse source
[na]]]; nested: QueryParsingException[[aa] Failed to parse query
[+dd:[10 to 40]]]; nested:
.... [follows the same]


(Jorge Urdaneta) #2

Ups! we just need to upcase the TO keyword... weird lucene rule

+dd:[10 TO 40]

On Nov 8, 11:34 am, Jorge Urdaneta jorge.urdan...@gmail.com wrote:

Hi,

I'm trying to support old lucene querys on ElasticSearch. Most querys
just work using QueryBuilders.queryString.
But we can't use range search using the braces syntax.

See my test case:https://gist.github.com/1348031

It throws an ugly exception

Exception in thread "main"
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed
to execute phase [query], total failure; shardFailures
{[99yDqrl_R6aSIin7tLOQpQ][aa][4]: SearchParseException[[aa][4]:
from[-1],size[-1]: Parse Failure [Failed to parse source [na]]];
nested: QueryParsingException[[aa] Failed to parse query [+dd:[10 to
40]]]; nested: ParseException[Cannot parse '+dd:[10 to 40]':
Encountered " <RANGEIN_GOOP> "40 "" at line 1, column 11.
Was expecting:
"]" ...
]; nested: ParseException[Encountered " <RANGEIN_GOOP> "40 "" at
line 1, column 11.
Was expecting:
"]" ...
]; }{[99yDqrl_R6aSIin7tLOQpQ][aa][0]: SearchParseException[[aa]
[0]: from[-1],size[-1]: Parse Failure [Failed to parse source
[na]]]; nested: QueryParsingException[[aa] Failed to parse query
[+dd:[10 to 40]]]; nested:
.... [follows the same]


(system) #3