How to specify time range in URI query?

Hi,
I need to use URI type of query string format (not the -d json type), and I need to specify the time range in the search string, but not sure how.

this works nicely:
curl -s -XGET ".../logstash-*/_search?size=5&q=metrictype:os+fields:datetime,cpu,disk"

after adding in the time, it failed:
curl -s -XGET '.../logstash-*/_search?q=metrictype:os+datetime:["2016-08-30 10:00:00" to "2016-08-30 10:30:00" ]+fields:datetime,cpu,disk'

or
curl -s -XGET ".../logstash-*/_search?q=metrictype:os+datetime:["2016-08-30 10:00:00" to "2016-08-30 10:30:00" ]+fields:datetime,cpu,disk"

Anyone has a working example? Thanks a lot!

You need to use TO instead of to.

Thank you David.
I made a few changes to make the command work:

  1. change to to TO
  2. use curl with -g option as suggested by some online article
  3. use below format for the time range, both works
    datetime:["2016-09-02T09:00:00"+TO+"2016-09-02T09:15:00"]
    datetime:[1472778000+TO+1472778900]

May be the format is "string" but not "date" as you can't search them.