Hi,
I have an index that was created with the following calls:
curl -XPUT 'http://localhost:9200/t/o/1' -d '{name:"May 1st",
date:"2010-05-01"}'
curl -XPUT 'http://localhost:9200/t/o/2' -d '{name:"May 2nd",
date:"2010-05-02"}'
curl -XPUT 'http://localhost:9200/t/o/3' -d '{name:"May 3rd",
date:"2010-05-03"}'
The date field in the schema is correctly created and looks like this:
"date" : {
"type" : "date",
"index_name" : "date",
"index" : "not_analyzed",
"store" : "no",
"term_vector" : "no",
"boost" : 1.0,
"omit_norms" : true,
"omit_term_freq_and_positions" : true,
"precision_step" : 4,
"format" : "dateOptionalTime"
}
When I do this query:
curl -XGET 'http://localhost:9200/t/o/_search?q=date:2010-05-01'
I get the expected results:
{"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":
1,"hits":[{"_index":"t","_type":"o","_id":"1", "_source" : {name:"May
1st", date:"2010-05-01"}}]}}
When I do this query:
curl -XGET 'http://localhost:9200/t/o/_search?q=date:[2010-05-01 TO
2010-05-03]'
I get this response:
curl: (3) [globbing] error: bad range specification after pos 43
When I do this query:
curl -XGET 'http://localhost:9200/t/o/_search?q=date:{2010-05-01 TO
2010-05-03}'
I get this error (on the server):
java.lang.IllegalArgumentException: invalid version format: TO
2010-05-03 HTTP/1.1
...
I thought that whatever I put the "q" parameter is passed to the
Lucene query parser. So the queries I tried to run should work (see
http://lucene.apache.org/java/3_0_1/queryparsersyntax.html#Range%20Searches)
Seems like it fails way before it ever gets to the Lucene query
parser.
Any ideas how to solve this? (I'd rather not use DSL to do range
queries)