# Adding time in a query?

**URL:** https://discuss.elastic.co/t/adding-time-in-a-query/881
**Category:** Kibana
**Created:** [May 19, 2015, 6:19am UTC](https://discuss.elastic.co/t/adding-time-in-a-query/881 "2015-05-19T06:19:20Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![obviouslygene](https://avatars.discourse-cdn.com/v4/letter/o/9d8465/32.png) [@obviouslygene](https://discuss.elastic.co/u/obviouslygene)
#### Post date: [May 19, 2015, 6:19am UTC](https://discuss.elastic.co/t/adding-time-in-a-query/881/1 "2015-05-19T06:19:20Z")

</div>

Hi, new to kibana here, so I was using splunk before and wanted to port my queries over.  
I was using the query as below.  
BATCH AND (succeeded OR failed) AND (start OR master) AND testsvr01  
Is it possible to add a time frame? Like from 07:00 to 07:10?  
I've tried adding @timestamp:[07:00 TO 07:05] and it does not work.  
Is there some thing I am doing wrong?

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [May 20, 2015, 8:35am UTC](https://discuss.elastic.co/t/adding-time-in-a-query/881/2 "2015-05-20T08:35:12Z")

</div>

The queried time range is defined via the time picker at the top right of the window, not sure you can do what you want via a query.

---

<div class="post-metadata">

### Author: ![obviouslygene](https://avatars.discourse-cdn.com/v4/letter/o/9d8465/32.png) [@obviouslygene](https://discuss.elastic.co/u/obviouslygene)
#### Post date: [May 20, 2015, 11:32am UTC](https://discuss.elastic.co/t/adding-time-in-a-query/881/3 "2015-05-20T11:32:27Z")

</div>

i see! thank you mark!  
i'll find a way around that.

---

<div class="post-metadata">

### Author: ![torstenfeld](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/torstenfeld/32/456_2.png) [@torstenfeld](https://discuss.elastic.co/u/torstenfeld)
#### Post date: [June 1, 2015, 3:01pm UTC](https://discuss.elastic.co/t/adding-time-in-a-query/881/4 "2015-06-01T15:01:15Z")

</div>

This might be interesting for me as well. @obviouslygene: did you find a solution / workaround for your use case?

---

<div class="post-metadata">

### Author: ![obviouslygene](https://avatars.discourse-cdn.com/v4/letter/o/9d8465/32.png) [@obviouslygene](https://discuss.elastic.co/u/obviouslygene)
#### Post date: [June 2, 2015, 5:06am UTC](https://discuss.elastic.co/t/adding-time-in-a-query/881/5 "2015-06-02T05:06:31Z")

</div>

hey @torstenfeld didn't get a solution for this specific type of query. I had to do a +@timestamp: [now-1h TO now]+host: "Server01"+message: ("succeeded \*" OR "failed \*") AND ( "script0 \*" OR "script1 \*") kinda query.

---

<div class="post-metadata">

### Author: ![Jason\_Wee](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@Jason\_Wee](https://discuss.elastic.co/u/Jason_Wee)
#### Post date: [June 2, 2015, 6:50am UTC](https://discuss.elastic.co/t/adding-time-in-a-query/881/6 "2015-06-02T06:50:06Z")

</div>

did you take a look at query string? [https://www.elastic.co/guide/en/elasticsearch/reference/1.x/query-dsl-query-string-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/1.x/query-dsl-query-string-query.html) you can use query string with condition like AND field, and search on specified field timestamp: [2012-01-01 TO 2012-12-31]

hth

jason

---

<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, 2:18pm UTC](https://discuss.elastic.co/t/adding-time-in-a-query/881/7 "2017-07-06T14:18:44Z")

</div>


