# DSL range quesry

**URL:** https://discuss.elastic.co/t/dsl-range-quesry/230476
**Category:** Elasticsearch
**Created:** [April 30, 2020, 6:57am UTC](https://discuss.elastic.co/t/dsl-range-quesry/230476 "2020-04-30T06:57:15Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Billz1026](https://avatars.discourse-cdn.com/v4/letter/b/67e7ee/32.png) [@Billz1026](https://discuss.elastic.co/u/Billz1026)
#### Post date: [April 30, 2020, 6:57am UTC](https://discuss.elastic.co/t/dsl-range-quesry/230476/1 "2020-04-30T06:57:15Z")

</div>

Hi all,

I am using Easticsearch to analyze Syslog data.

I want to filter logs between two time stamps on a given day. I have used following DSL query to do that in Kibana but, it is not giving the exact result I want.

` { "query": { "range": { "Log_Time": { "gte": "09:24:31", "lte": "10:25:31" } } } }`

The problem is, query does not match the time field as a complete unit but matching each segment each element separately. For an example, above query matches a log with following as well because of `24` field which is it shouldn't

`Log_Time : 11:24:35`

Please help me to resolve this...

Thanks in advance,  
Billz

---

<div class="post-metadata">

### Author: ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)
#### Post date: [April 30, 2020, 9:49am UTC](https://discuss.elastic.co/t/dsl-range-quesry/230476/2 "2020-04-30T09:49:51Z")

</div>

This looks like "Log\_Time" is not mapped/indexed as a date field with a format that matches your query format (something like "HH:mm:ss") but as a text field. You can check this using the "\_mapping" API. To be able to search date ranges like you seem to try, you need a [date field](https://www.elastic.co/guide/en/elasticsearch/reference/current/date.html).

---

<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: [May 28, 2020, 9:49am UTC](https://discuss.elastic.co/t/dsl-range-quesry/230476/3 "2020-05-28T09:49:52Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
