# Command line query for time range

**URL:** https://discuss.elastic.co/t/command-line-query-for-time-range/22503
**Category:** Elasticsearch
**Created:** [March 3, 2015, 11:56pm UTC](https://discuss.elastic.co/t/command-line-query-for-time-range/22503 "2015-03-03T23:56:20Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Ross\_Wentworth](https://avatars.discourse-cdn.com/v4/letter/r/f19dbf/32.png) [@Ross\_Wentworth](https://discuss.elastic.co/u/Ross_Wentworth)
#### Post date: [March 3, 2015, 11:56pm UTC](https://discuss.elastic.co/t/command-line-query-for-time-range/22503/1 "2015-03-03T23:56:20Z")

</div>

I need to pull data from elasticsearch with required matches on specific  
host, res.statusCode indicating an error, and within the past hour and send  
an email to the programmers with this information. The script will be run  
hourly. Using curl, I am almost able to get it with this (not encoded for  
easy reading):

curl [http://localhost:9200/\_search?+host:my.host.name](http://localhost:9200/_search?+host:my.host.name) +res.statusCode: [400  
TO \*]

But I can't figure out how to handle the time portion. Any suggestions or  
a link to the answer?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/2f60b64c-df58-47e7-b91a-c72ad8095b70%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2f60b64c-df58-47e7-b91a-c72ad8095b70%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Ross\_Wentworth](https://avatars.discourse-cdn.com/v4/letter/r/f19dbf/32.png) [@Ross\_Wentworth](https://discuss.elastic.co/u/Ross_Wentworth)
#### Post date: [March 4, 2015, 12:07am UTC](https://discuss.elastic.co/t/command-line-query-for-time-range/22503/2 "2015-03-04T00:07:33Z")

</div>

Never mind, I figured out the synax is "+@timestamp: [YYYY-MM-DDTHH:MM:SS  
TO YYYY-MM-DDTHH:MM:SS]"

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/5a012e00-483f-4e46-ac5d-3e51ef4c9108%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/5a012e00-483f-4e46-ac5d-3e51ef4c9108%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:28am UTC](https://discuss.elastic.co/t/command-line-query-for-time-range/22503/3 "2017-07-06T00:28:45Z")

</div>


