# Lucene Query Language using now date time

**URL:** https://discuss.elastic.co/t/lucene-query-language-using-now-date-time/275579
**Category:** Kibana
**Created:** [June 10, 2021, 1:36pm UTC](https://discuss.elastic.co/t/lucene-query-language-using-now-date-time/275579 "2021-06-10T13:36:43Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![sam3546](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sam3546/32/79281_2.png) [@sam3546](https://discuss.elastic.co/u/sam3546)
#### Post date: [June 10, 2021, 1:36pm UTC](https://discuss.elastic.co/t/lucene-query-language-using-now-date-time/275579/1 "2021-06-10T13:36:43Z")

</div>

In Lucene for a date range its possible to do date:{\* TO 2012-01-01}, is it possible to use the now date time such as

date:{now-60d/d TO now/d}

---

<div class="post-metadata">

### Author: ![devon.thomson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/devon.thomson/32/85468_2.png) [@devon.thomson](https://discuss.elastic.co/u/devon.thomson)
#### Post date: [June 10, 2021, 7:59pm UTC](https://discuss.elastic.co/t/lucene-query-language-using-now-date-time/275579/2 "2021-06-10T19:59:40Z")

</div>

This should work. See the discussion [here](https://discuss.elastic.co/t/lucene-syntax-equivalent-for-today-does-it-exist/204699/4) for more information, but it looks like this is supported in Lucene and KQL.

---

<div class="post-metadata">

### Author: ![sam3546](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sam3546/32/79281_2.png) [@sam3546](https://discuss.elastic.co/u/sam3546)
#### Post date: [June 11, 2021, 8:54am UTC](https://discuss.elastic.co/t/lucene-query-language-using-now-date-time/275579/3 "2021-06-11T08:54:10Z")

</div>

Thanks for the response @devon.thomson and the link, I read the article linked and tried it out and it does work fine in KQL but i have not been able to get it to work in Lucene. Any other format than

```auto
date.field >= "now-1d/d+11h"

```

and it errors and that format above does not return any results. I am running Elastic/Kibana 7.9 which could be unsupported?

Im having to use Lucene as im trying to get [Filter Ratio](https://discuss.elastic.co/t/tsvb-aggregation-filter/275477) to work which i asked a question on also.

Cheers anyway.

---

<div class="post-metadata">

### Author: ![sam3546](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sam3546/32/79281_2.png) [@sam3546](https://discuss.elastic.co/u/sam3546)
#### Post date: [June 29, 2021, 4:19pm UTC](https://discuss.elastic.co/t/lucene-query-language-using-now-date-time/275579/4 "2021-06-29T16:19:56Z")

</div>

Follow up

Lucene doesn't support it so re-configured the field to just hold the date its invalid date \> now/d

---

<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 27, 2021, 4:20pm UTC](https://discuss.elastic.co/t/lucene-query-language-using-now-date-time/275579/5 "2021-07-27T16:20:41Z")

</div>

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