Range Query

Hi All,

I have one question in range query....

  1. How to search with only one range i.e, either from range or to
    range.....?

    I have tried like this....

curl -XGET 'http://localhost:9200/dbtest/metadata/_search' -d
'{ "query":{ "range" : {"myfield" : {"from" : "1","to" : "*",
"include_lower" : true, "include_upper" : true}}}}'

I am getting error here is...

{"error":"SearchPhaseExecutionException[Failed to execute phase
[query], total f
ailure; shardFailures {[ILV-__B3Tau7KR_uqzlrSA][db2267][0]:
RemoteTransportExcep
tion[[Stegron][inet[/192.168.65.1:9302]][search/phase/query]]; nested:
SearchPar
seException[[db2267][0]: from[-1],size[-1]: Parse Failure [Failed to
parse sourc
e [{ "query" :{ "range" : {"m_pagecount" : {"from" : "1","to
" : "
", "include_lower" : true, "include_upper" : true}}}}]]]; nested:
NumberForm
atException[For input string: "
"]; }{[ILV-__B3Tau7KR_uqzlrSA]
[db2267][1]: Rem
oteTransportException[[Stegron][inet[/192.168.65.1:9302]][search/phase/
query]];
nested: SearchParseException[[db2267][1]: from[-1],size[-1]: Parse
Failure [Fail
ed to parse source [{ "query" :{ "range" : {"m_pagecount" :
{"from" : "
1","to" : "", "include_lower" : true, "include_upper" :
true}}}}]]]; n
ested: NumberFormatException[For input string: "
"]; }]"}

How can i search with only one range.......?

Hi,

the documentation (
http://www.elasticsearch.com/docs/elasticsearch/rest_api/query_dsl/range_query/
) tells this:
"to": The upper bound. Defaults to unbounded.

So you can use same query without the "to" part (and remove the
"include_upper" too)

Ludo

On Mon, Jan 24, 2011 at 3:51 PM, Arulkumar arulkumarcs@gmail.com wrote:

Hi All,

I have one question in range query....

  1. How to search with only one range i.e, either from range or to
    range.....?

    I have tried like this....

curl -XGET 'http://localhost:9200/dbtest/metadata/_search' -d
'{ "query":{ "range" : {"myfield" : {"from" : "1","to" : "*",
"include_lower" : true, "include_upper" : true}}}}'

I am getting error here is...

{"error":"SearchPhaseExecutionException[Failed to execute phase
[query], total f
ailure; shardFailures {[ILV-__B3Tau7KR_uqzlrSA][db2267][0]:
RemoteTransportExcep
tion[[Stegron][inet[/192.168.65.1:9302]][search/phase/query]]; nested:
SearchPar
seException[[db2267][0]: from[-1],size[-1]: Parse Failure [Failed to
parse sourc
e [{ "query" :{ "range" : {"m_pagecount" : {"from" : "1","to
" : "
", "include_lower" : true, "include_upper" : true}}}}]]]; nested:
NumberForm
atException[For input string: "
"]; }{[ILV-__B3Tau7KR_uqzlrSA]
[db2267][1]: Rem
oteTransportException[[Stegron][inet[/192.168.65.1:9302]][search/phase/
query]];
nested: SearchParseException[[db2267][1]: from[-1],size[-1]: Parse
Failure [Fail
ed to parse source [{ "query" :{ "range" : {"m_pagecount" :
{"from" : "
1","to" : "", "include_lower" : true, "include_upper" :
true}}}}]]]; n
ested: NumberFormatException[For input string: "
"]; }]"}

How can i search with only one range.......?