Time range filter


(Tom Miller) #1

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(vineeth mohan-2) #2

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.
    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 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.
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?utm_medium=email&utm_source=footer
.
For more options, visit 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kFZMt1nuUfBJkwPuFkBCGN4ZUHXESxPn6Ccy9F0QL5xA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Shay Banon) #3

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 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. 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 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/943a4cca-ee2c-497a-840e-be39ad821a0f%40googlegroups.com.
For more options, visit 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kFZMt1nuUfBJkwPuFkBCGN4ZUHXESxPn6Ccy9F0QL5xA%40mail.gmail.com.
For more options, visit 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/D18BC2AF-20BF-4CC1-94B7-B189E9193607%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Tom Miller) #4

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 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 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.
    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 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.
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?utm_medium=email&utm_source=footer
.
For more options, visit 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.
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?utm_medium=email&utm_source=footer
.
For more options, visit 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.
To unsubscribe from this group and all its topics, send an email to
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?utm_medium=email&utm_source=footer
.

For more options, visit 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.ukuk tom.miller@ebiz.co.uk |
web: ebiz.uk | www.facebook.com/eBizUK | 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

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAM9sqB25Y3o86_y8N7eGo8tBpBaub9kY9zjwZOdozymfLP1qqw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(vineeth mohan-2) #5

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 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 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 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.
    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 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.
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?utm_medium=email&utm_source=footer
.
For more options, visit 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.
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?utm_medium=email&utm_source=footer
.
For more options, visit 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.
To unsubscribe from this group and all its topics, send an email to
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?utm_medium=email&utm_source=footer
.

For more options, visit 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.ukuk tom.miller@ebiz.co.uk |
web: ebiz.uk | www.facebook.com/eBizUK | 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

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.
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?utm_medium=email&utm_source=footer
.

For more options, visit 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5mijn4kBG7%2BKiBYz8aVZTLskaVu72A5Ono0AKCuvzjU%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Tom Miller) #6

On 8 July 2014 22:06, vineeth mohan 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 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 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
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.
    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
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.
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?utm_medium=email&utm_source=footer
.
For more options, visit 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.
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?utm_medium=email&utm_source=footer
.
For more options, visit 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.
To unsubscribe from this group and all its topics, send an email to
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?utm_medium=email&utm_source=footer
.

For more options, visit 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.ukuk tom.miller@ebiz.co.uk |
web: ebiz.uk | www.facebook.com/eBizUK | 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

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.
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?utm_medium=email&utm_source=footer
.

For more options, visit 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.
To unsubscribe from this group and all its topics, send an email to
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?utm_medium=email&utm_source=footer
.

For more options, visit 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.ukuk tom.miller@ebiz.co.uk |
web: ebiz.uk | www.facebook.com/eBizUK | 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

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.
To view this discussion on the web visit 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.


(system) #7