New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date Mapping: Support "date math" when searching #1708

Closed
kimchy opened this Issue Feb 16, 2012 · 3 comments

Comments

Projects
None yet
4 participants
@kimchy
Member

kimchy commented Feb 16, 2012

Date math on date types allows to compose search values that include simple data math expressions.

The expression starts with an "anchor" date, which can be either now or a date string (in the applicable format) ending with ||. It can then follow by a math expression, supporting +, - and / (rounding). The units supported are M (month), w (week), h (hour), m (minute), and s (second).

Here are some samples: now+1h, now+1h+1m, now+1h/d, 2012-01-01||+1M/d.

Now, when doing range type searches, and the upper value is inclusive, the rounding will properly be rounded to the ceiling instead of flooring it.

@kimchy kimchy closed this in f997315 Feb 16, 2012

@jeremy

This comment has been minimized.

Show comment
Hide comment
@jeremy

jeremy Feb 16, 2012

Killer feature. This is very convenient. 🤘

jeremy commented Feb 16, 2012

Killer feature. This is very convenient. 🤘

@trekr5

This comment has been minimized.

Show comment
Hide comment
@trekr5

trekr5 Jun 17, 2015

How would you use date math to find values from a previous day's index? would you have to put in the actual date or could you use things like "midnight", "yesterday"?

Say I wanted to find values for an es query for yesterday with a moving window of 2 hours? would I put in my date range "gt"=> "2015-06-16||-2h/d"

trekr5 commented Jun 17, 2015

How would you use date math to find values from a previous day's index? would you have to put in the actual date or could you use things like "midnight", "yesterday"?

Say I wanted to find values for an es query for yesterday with a moving window of 2 hours? would I put in my date range "gt"=> "2015-06-16||-2h/d"

@markwalkom

This comment has been minimized.

Show comment
Hide comment
@markwalkom

markwalkom Jun 17, 2015

Member

@trekr5 Please join us in #elasticsearch on Freenode or at https://discuss.elastic.co/ for troubleshooting help :)

Member

markwalkom commented Jun 17, 2015

@trekr5 Please join us in #elasticsearch on Freenode or at https://discuss.elastic.co/ for troubleshooting help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment