# Time range filter

**URL:** <https://discuss.elastic.co/t/time-range-filter/18518>\
**Category:** Elasticsearch\
**Created:** [July 8, 2014, 1:49am UTC](https://discuss.elastic.co/t/time-range-filter/18518 "2014-07-08T01:49:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom\_Miller](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tom_miller/32/774_2.png) [@Tom\_Miller](https://discuss.elastic.co/u/Tom_Miller)\
**Post date:** [July 8, 2014, 1:49am UTC](https://discuss.elastic.co/t/time-range-filter/18518/1 "2014-07-08T01:49:40Z")

</div>

All of the examples I can find on the web relate to date-range filtering.  
What I need is a time-range filter: i,e  
19:00 - 23:30.

So, in this example, I want all hits between 7PM and 11:30, regardless of  
the day...

I'd do this in SQL by doing "Where TIME(column) BETWEEN x and y".

Is this possible in elasticsearch?

My only solution thus far is to date\_histogram by hour, and then filter on  
the client and add them up, which is kinda lame...

--  
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/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineeth_mohan_2/32/747_2.png) [@vineeth\_mohan\_2](https://discuss.elastic.co/u/vineeth_mohan_2)\
**Post date:** [July 8, 2014, 4:06am UTC](https://discuss.elastic.co/t/time-range-filter/18518/2 "2014-07-08T04:06:10Z")

</div>

Hello Tom ,

At this point , i can think of 2 approaches -

1. Store an additioanl field with just the time and not the date  
information. Do a normal range query here.
2. Create script filters - In the filter , take the time out and check  
the range.  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-script-filter.html)

But then this is a common use case and some elegant way to do it should  
exist.  
If not , I will create a bug.

Thanks  
Vineeth

On Tue, Jul 8, 2014 at 7:19 AM, Tom Miller [tom.miller@ebiz.co.uk](mailto:tom.miller@ebiz.co.uk) wrote:

> All of the examples I can find on the web relate to date-range filtering.  
> What I need is a time-range filter: i,e  
> 19:00 - 23:30.
> 
> So, in this example, I want all hits between 7PM and 11:30, regardless of  
> the day...
> 
> I'd do this in SQL by doing "Where TIME(column) BETWEEN x and y".
> 
> Is this possible in elasticsearch?
> 
> My only solution thus far is to date\_histogram by hour, and then filter on  
> the client and add them up, which is kinda lame...
> 
> --  
> 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/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CAGdPd5kFZMt1nuUfBJkwPuFkBCGN4ZUHXESxPn6Ccy9F0QL5xA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kFZMt1nuUfBJkwPuFkBCGN4ZUHXESxPn6Ccy9F0QL5xA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [July 8, 2014, 6:54pm UTC](https://discuss.elastic.co/t/time-range-filter/18518/3 "2014-07-08T18:54:46Z")

</div>

Aye, make sense to add a dedicated filter for this, care to open an issue?

On Jul 8, 2014, at 6:06, vineeth mohan [vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com) wrote:

> Hello Tom ,
> 
> At this point , i can think of 2 approaches -
> 
> Store an additioanl field with just the time and not the date information. Do a normal range query here.  
> Create script filters - In the filter , take the time out and check the range. [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-script-filter.html)
> 
> But then this is a common use case and some elegant way to do it should exist.  
> If not , I will create a bug.
> 
> Thanks  
> Vineeth
> 
> On Tue, Jul 8, 2014 at 7:19 AM, Tom Miller [tom.miller@ebiz.co.uk](mailto:tom.miller@ebiz.co.uk) wrote:  
> All of the examples I can find on the web relate to date-range filtering. What I need is a time-range filter: i,e  
> 19:00 - 23:30.
> 
> So, in this example, I want all hits between 7PM and 11:30, regardless of the day...
> 
> I'd do this in SQL by doing "Where TIME(column) BETWEEN x and y".
> 
> Is this possible in elasticsearch?
> 
> My only solution thus far is to date\_histogram by hour, and then filter on the client and add them up, which is kinda lame...
> 
> --  
> 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/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> 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/CAGdPd5kFZMt1nuUfBJkwPuFkBCGN4ZUHXESxPn6Ccy9F0QL5xA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kFZMt1nuUfBJkwPuFkBCGN4ZUHXESxPn6Ccy9F0QL5xA%40mail.gmail.com).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/D18BC2AF-20BF-4CC1-94B7-B189E9193607%40gmail.com](https://groups.google.com/d/msgid/elasticsearch/D18BC2AF-20BF-4CC1-94B7-B189E9193607%40gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Tom\_Miller](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tom_miller/32/774_2.png) [@Tom\_Miller](https://discuss.elastic.co/u/Tom_Miller)\
**Post date:** [July 8, 2014, 7:36pm UTC](https://discuss.elastic.co/t/time-range-filter/18518/4 "2014-07-08T19:36:08Z")

</div>

Thanks guys - I've created a ticket in github. I'll store the time  
separately for now as Vineeth suggested.

Thanks again.

Tom.

On 8 July 2014 19:54, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> Aye, make sense to add a dedicated filter for this, care to open an issue?
> 
> On Jul 8, 2014, at 6:06, vineeth mohan [vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com) wrote:
> 
> Hello Tom ,
> 
> At this point , i can think of 2 approaches -
> 
> 1. Store an additioanl field with just the time and not the date  
> information. Do a normal range query here.
> 2. Create script filters - In the filter , take the time out and check  
> the range.  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-script-filter.html)
> 
> But then this is a common use case and some elegant way to do it should  
> exist.  
> If not , I will create a bug.
> 
> Thanks  
> Vineeth
> 
> On Tue, Jul 8, 2014 at 7:19 AM, Tom Miller [tom.miller@ebiz.co.uk](mailto:tom.miller@ebiz.co.uk) wrote:
> 
> > All of the examples I can find on the web relate to date-range filtering.  
> > What I need is a time-range filter: i,e  
> > 19:00 - 23:30.
> > 
> > So, in this example, I want all hits between 7PM and 11:30, regardless of  
> > the day...
> > 
> > I'd do this in SQL by doing "Where TIME(column) BETWEEN x and y".
> > 
> > Is this possible in elasticsearch?
> > 
> > My only solution thus far is to date\_histogram by hour, and then filter  
> > on the client and add them up, which is kinda lame...
> > 
> > --  
> > 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/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> 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/CAGdPd5kFZMt1nuUfBJkwPuFkBCGN4ZUHXESxPn6Ccy9F0QL5xA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kFZMt1nuUfBJkwPuFkBCGN4ZUHXESxPn6Ccy9F0QL5xA%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kFZMt1nuUfBJkwPuFkBCGN4ZUHXESxPn6Ccy9F0QL5xA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kFZMt1nuUfBJkwPuFkBCGN4ZUHXESxPn6Ccy9F0QL5xA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/KQiqJ-ZiIlw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/KQiqJ-ZiIlw/unsubscribe).  
> To unsubscribe from this group and all its topics, 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/D18BC2AF-20BF-4CC1-94B7-B189E9193607%40gmail.com](https://groups.google.com/d/msgid/elasticsearch/D18BC2AF-20BF-4CC1-94B7-B189E9193607%40gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/D18BC2AF-20BF-4CC1-94B7-B189E9193607%40gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/D18BC2AF-20BF-4CC1-94B7-B189E9193607%40gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--

Tom Miller

Managing Director

=======================================================

eBiz

Centurion House, London Road, Staines, TW18 4AX

Tel: 08448 045046

email: tom.miller@ebiz. [tom.miller@ebiz.uk](mailto:tom.miller@ebiz.uk)uk [tom.miller@ebiz.co.uk](mailto:tom.miller@ebiz.co.uk) |  
web: [ebiz.uk](http://ebiz.uk) | [eBiz | Staines](http://www.facebook.com/eBizUK) | [www.twitter.com/eBizUK](http://www.twitter.com/eBizUK)

Information contained in this communication may be confidential and/or  
legally privileged. It is intended solely for the use of the addressee and  
others authorized to receive it. If you are not the intended recipient any  
disclosure, copying, distribution or action taken in reliance on its  
contents is prohibited and may be unlawful. Neither eBiz | interactive  
business solutions nor the author accepts legal liability for the contents  
of this message. If you receive this communication in error please advise  
us at [privacy@ebiz.co.uk](mailto:privacy@ebiz.co.uk)

Whilst we run anti-virus software we are not liable for any loss/damage  
sustained as a result of software viruses. The recipients are advised to  
run their own anti-virus software

--  
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/CAM9sqB25Y3o86\_y8N7eGo8tBpBaub9kY9zjwZOdozymfLP1qqw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAM9sqB25Y3o86_y8N7eGo8tBpBaub9kY9zjwZOdozymfLP1qqw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineeth_mohan_2/32/747_2.png) [@vineeth\_mohan\_2](https://discuss.elastic.co/u/vineeth_mohan_2)\
**Post date:** [July 8, 2014, 9:06pm UTC](https://discuss.elastic.co/t/time-range-filter/18518/5 "2014-07-08T21:06:27Z")

</div>

Hello Tom ,

Please paste the link to the issue.  
I am seeing more of such request in the forum.

Thanks  
Vineeth

On Wed, Jul 9, 2014 at 1:06 AM, Tom Miller [tom.miller@ebiz.co.uk](mailto:tom.miller@ebiz.co.uk) wrote:

> Thanks guys - I've created a ticket in github. I'll store the time  
> separately for now as Vineeth suggested.
> 
> Thanks again.
> 
> Tom.
> 
> On 8 July 2014 19:54, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> 
> > Aye, make sense to add a dedicated filter for this, care to open an issue?
> > 
> > On Jul 8, 2014, at 6:06, vineeth mohan [vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com) wrote:
> > 
> > Hello Tom ,
> > 
> > At this point , i can think of 2 approaches -
> > 
> > 1. Store an additioanl field with just the time and not the date  
> > information. Do a normal range query here.
> > 2. Create script filters - In the filter , take the time out and  
> > check the range.  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-script-filter.html)
> > 
> > But then this is a common use case and some elegant way to do it should  
> > exist.  
> > If not , I will create a bug.
> > 
> > Thanks  
> > Vineeth
> > 
> > On Tue, Jul 8, 2014 at 7:19 AM, Tom Miller [tom.miller@ebiz.co.uk](mailto:tom.miller@ebiz.co.uk) wrote:
> > 
> > > All of the examples I can find on the web relate to date-range  
> > > filtering. What I need is a time-range filter: i,e  
> > > 19:00 - 23:30.
> > > 
> > > So, in this example, I want all hits between 7PM and 11:30, regardless  
> > > of the day...
> > > 
> > > I'd do this in SQL by doing "Where TIME(column) BETWEEN x and y".
> > > 
> > > Is this possible in elasticsearch?
> > > 
> > > My only solution thus far is to date\_histogram by hour, and then filter  
> > > on the client and add them up, which is kinda lame...
> > > 
> > > --  
> > > 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/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > 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/CAGdPd5kFZMt1nuUfBJkwPuFkBCGN4ZUHXESxPn6Ccy9F0QL5xA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kFZMt1nuUfBJkwPuFkBCGN4ZUHXESxPn6Ccy9F0QL5xA%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kFZMt1nuUfBJkwPuFkBCGN4ZUHXESxPn6Ccy9F0QL5xA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kFZMt1nuUfBJkwPuFkBCGN4ZUHXESxPn6Ccy9F0QL5xA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/KQiqJ-ZiIlw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/KQiqJ-ZiIlw/unsubscribe).  
> > To unsubscribe from this group and all its topics, 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/D18BC2AF-20BF-4CC1-94B7-B189E9193607%40gmail.com](https://groups.google.com/d/msgid/elasticsearch/D18BC2AF-20BF-4CC1-94B7-B189E9193607%40gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/D18BC2AF-20BF-4CC1-94B7-B189E9193607%40gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/D18BC2AF-20BF-4CC1-94B7-B189E9193607%40gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --
> 
> Tom Miller
> 
> Managing Director
> 
> =======================================================
> 
> eBiz
> 
> Centurion House, London Road, Staines, TW18 4AX
> 
> Tel: 08448 045046
> 
> email: tom.miller@ebiz. [tom.miller@ebiz.uk](mailto:tom.miller@ebiz.uk)uk [tom.miller@ebiz.co.uk](mailto:tom.miller@ebiz.co.uk) |  
> web: [ebiz.uk](http://ebiz.uk) | [eBiz | Staines](http://www.facebook.com/eBizUK) | [www.twitter.com/eBizUK](http://www.twitter.com/eBizUK)
> 
> Information contained in this communication may be confidential and/or  
> legally privileged. It is intended solely for the use of the addressee and  
> others authorized to receive it. If you are not the intended recipient any  
> disclosure, copying, distribution or action taken in reliance on its  
> contents is prohibited and may be unlawful. Neither eBiz | interactive  
> business solutions nor the author accepts legal liability for the contents  
> of this message. If you receive this communication in error please advise  
> us at [privacy@ebiz.co.uk](mailto:privacy@ebiz.co.uk)
> 
> Whilst we run anti-virus software we are not liable for any loss/damage  
> sustained as a result of software viruses. The recipients are advised to  
> run their own anti-virus software
> 
> --  
> 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/CAM9sqB25Y3o86\_y8N7eGo8tBpBaub9kY9zjwZOdozymfLP1qqw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAM9sqB25Y3o86_y8N7eGo8tBpBaub9kY9zjwZOdozymfLP1qqw%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAM9sqB25Y3o86\_y8N7eGo8tBpBaub9kY9zjwZOdozymfLP1qqw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAM9sqB25Y3o86_y8N7eGo8tBpBaub9kY9zjwZOdozymfLP1qqw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CAGdPd5mijn4kBG7%2BKiBYz8aVZTLskaVu72A5Ono0AKCuvzjU%2Bg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5mijn4kBG7%2BKiBYz8aVZTLskaVu72A5Ono0AKCuvzjU%2Bg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Tom\_Miller](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tom_miller/32/774_2.png) [@Tom\_Miller](https://discuss.elastic.co/u/Tom_Miller)\
**Post date:** [July 8, 2014, 11:03pm UTC](https://discuss.elastic.co/t/time-range-filter/18518/6 "2014-07-08T23:03:56Z")

</div>

> <https://github.com/elastic/elasticsearch/issues/6785>
>
> At present there is no way to filter with time range, only date range - for exam…ple: you cannot do 7PM - 11PM (ignoring the date) without storing the time in a separate field.

On 8 July 2014 22:06, vineeth mohan [vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com) wrote:

> Hello Tom ,
> 
> Please paste the link to the issue.  
> I am seeing more of such request in the forum.
> 
> Thanks  
> Vineeth
> 
> On Wed, Jul 9, 2014 at 1:06 AM, Tom Miller [tom.miller@ebiz.co.uk](mailto:tom.miller@ebiz.co.uk) wrote:
> 
> > Thanks guys - I've created a ticket in github. I'll store the time  
> > separately for now as Vineeth suggested.
> > 
> > Thanks again.
> > 
> > Tom.
> > 
> > On 8 July 2014 19:54, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > 
> > > Aye, make sense to add a dedicated filter for this, care to open an  
> > > issue?
> > > 
> > > On Jul 8, 2014, at 6:06, vineeth mohan [vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com)  
> > > wrote:
> > > 
> > > Hello Tom ,
> > > 
> > > At this point , i can think of 2 approaches -
> > > 
> > > 1. Store an additioanl field with just the time and not the date  
> > > information. Do a normal range query here.
> > > 2. Create script filters - In the filter , take the time out and  
> > > check the range.  
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-script-filter.html)
> > > 
> > > But then this is a common use case and some elegant way to do it should  
> > > exist.  
> > > If not , I will create a bug.
> > > 
> > > Thanks  
> > > Vineeth
> > > 
> > > On Tue, Jul 8, 2014 at 7:19 AM, Tom Miller [tom.miller@ebiz.co.uk](mailto:tom.miller@ebiz.co.uk)  
> > > wrote:
> > > 
> > > > All of the examples I can find on the web relate to date-range  
> > > > filtering. What I need is a time-range filter: i,e  
> > > > 19:00 - 23:30.
> > > > 
> > > > So, in this example, I want all hits between 7PM and 11:30, regardless  
> > > > of the day...
> > > > 
> > > > I'd do this in SQL by doing "Where TIME(column) BETWEEN x and y".
> > > > 
> > > > Is this possible in elasticsearch?
> > > > 
> > > > My only solution thus far is to date\_histogram by hour, and then filter  
> > > > on the client and add them up, which is kinda lame...
> > > > 
> > > > --  
> > > > 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/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .  
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > 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/CAGdPd5kFZMt1nuUfBJkwPuFkBCGN4ZUHXESxPn6Ccy9F0QL5xA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kFZMt1nuUfBJkwPuFkBCGN4ZUHXESxPn6Ccy9F0QL5xA%40mail.gmail.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kFZMt1nuUfBJkwPuFkBCGN4ZUHXESxPn6Ccy9F0QL5xA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kFZMt1nuUfBJkwPuFkBCGN4ZUHXESxPn6Ccy9F0QL5xA%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > .  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/KQiqJ-ZiIlw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/KQiqJ-ZiIlw/unsubscribe).  
> > > To unsubscribe from this group and all its topics, 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/D18BC2AF-20BF-4CC1-94B7-B189E9193607%40gmail.com](https://groups.google.com/d/msgid/elasticsearch/D18BC2AF-20BF-4CC1-94B7-B189E9193607%40gmail.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/D18BC2AF-20BF-4CC1-94B7-B189E9193607%40gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/D18BC2AF-20BF-4CC1-94B7-B189E9193607%40gmail.com?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --
> > 
> > Tom Miller
> > 
> > Managing Director
> > 
> > =======================================================
> > 
> > eBiz
> > 
> > Centurion House, London Road, Staines, TW18 4AX
> > 
> > Tel: 08448 045046
> > 
> > email: tom.miller@ebiz. [tom.miller@ebiz.uk](mailto:tom.miller@ebiz.uk)uk [tom.miller@ebiz.co.uk](mailto:tom.miller@ebiz.co.uk) |  
> > web: [ebiz.uk](http://ebiz.uk) | [eBiz | Staines](http://www.facebook.com/eBizUK) | [www.twitter.com/eBizUK](http://www.twitter.com/eBizUK)
> > 
> > Information contained in this communication may be confidential and/or  
> > legally privileged. It is intended solely for the use of the addressee and  
> > others authorized to receive it. If you are not the intended recipient any  
> > disclosure, copying, distribution or action taken in reliance on its  
> > contents is prohibited and may be unlawful. Neither eBiz | interactive  
> > business solutions nor the author accepts legal liability for the contents  
> > of this message. If you receive this communication in error please advise  
> > us at [privacy@ebiz.co.uk](mailto:privacy@ebiz.co.uk)
> > 
> > Whilst we run anti-virus software we are not liable for any loss/damage  
> > sustained as a result of software viruses. The recipients are advised to  
> > run their own anti-virus software
> > 
> > --  
> > 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/CAM9sqB25Y3o86\_y8N7eGo8tBpBaub9kY9zjwZOdozymfLP1qqw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAM9sqB25Y3o86_y8N7eGo8tBpBaub9kY9zjwZOdozymfLP1qqw%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CAM9sqB25Y3o86\_y8N7eGo8tBpBaub9kY9zjwZOdozymfLP1qqw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAM9sqB25Y3o86_y8N7eGo8tBpBaub9kY9zjwZOdozymfLP1qqw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/KQiqJ-ZiIlw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/KQiqJ-ZiIlw/unsubscribe).  
> To unsubscribe from this group and all its topics, 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/CAGdPd5mijn4kBG7%2BKiBYz8aVZTLskaVu72A5Ono0AKCuvzjU%2Bg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5mijn4kBG7%2BKiBYz8aVZTLskaVu72A5Ono0AKCuvzjU%2Bg%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5mijn4kBG7%2BKiBYz8aVZTLskaVu72A5Ono0AKCuvzjU%2Bg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5mijn4kBG7%2BKiBYz8aVZTLskaVu72A5Ono0AKCuvzjU%2Bg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--

Tom Miller

Managing Director

=======================================================

eBiz

Centurion House, London Road, Staines, TW18 4AX

Tel: 08448 045046

email: tom.miller@ebiz. [tom.miller@ebiz.uk](mailto:tom.miller@ebiz.uk)uk [tom.miller@ebiz.co.uk](mailto:tom.miller@ebiz.co.uk) |  
web: [ebiz.uk](http://ebiz.uk) | [eBiz | Staines](http://www.facebook.com/eBizUK) | [www.twitter.com/eBizUK](http://www.twitter.com/eBizUK)

Information contained in this communication may be confidential and/or  
legally privileged. It is intended solely for the use of the addressee and  
others authorized to receive it. If you are not the intended recipient any  
disclosure, copying, distribution or action taken in reliance on its  
contents is prohibited and may be unlawful. Neither eBiz | interactive  
business solutions nor the author accepts legal liability for the contents  
of this message. If you receive this communication in error please advise  
us at [privacy@ebiz.co.uk](mailto:privacy@ebiz.co.uk)

Whilst we run anti-virus software we are not liable for any loss/damage  
sustained as a result of software viruses. The recipients are advised to  
run their own anti-virus software

--  
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/CAM9sqB3ufiECS6Cw1hagcA%3DTVA86w9w-dqBB6yw\_eEoR4kM7%2BQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAM9sqB3ufiECS6Cw1hagcA%3DTVA86w9w-dqBB6yw_eEoR4kM7%2BQ%40mail.gmail.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, 1:17am UTC](https://discuss.elastic.co/t/time-range-filter/18518/7 "2017-07-06T01:17:11Z")

</div>


