# Discover not filtering for date properly

**URL:** <https://discuss.elastic.co/t/discover-not-filtering-for-date-properly/353495>\
**Category:** Elastic Search\
**Tags:** elastic-workplace-search\
**Created:** [February 17, 2024, 1:09am UTC](https://discuss.elastic.co/t/discover-not-filtering-for-date-properly/353495 "2024-02-17T01:09:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Divya\_Kd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_kd/32/131830_2.png) [@Divya\_Kd](https://discuss.elastic.co/u/Divya_Kd)\
**Post date:** [February 17, 2024, 1:09am UTC](https://discuss.elastic.co/t/discover-not-filtering-for-date-properly/353495/1 "2024-02-17T01:09:15Z")

</div>

Elastic Search for a date filter is not working. If I give my filter as "logintime is 2024-01-25" , I was expecting it would bring all data with login time 2024-01-25 but it also bring data for login time = 2024-01-24 as well. Please find the screenshot, can someone please help me with this, I do not want to use "is between" since i am using this url for my drill down url and I am unable to get this filter in my lens.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/9/e9e36d26e89c792b1e5e79d3f371519a76cd46a8.png)

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [February 17, 2024, 3:41pm UTC](https://discuss.elastic.co/t/discover-not-filtering-for-date-properly/353495/2 "2024-02-17T15:41:46Z")

</div>

Hi @Divya_Kd Welcome to the community!

That is because Elasticsearch **stores** all dates in UTC but Kibana Display them Local to Kibana ....

In general this make working with Discover make sense in Local Time

BUT When you use a Filter with a Date/Time, though, that date you entered is treated as UTC...

Time Picker which is what is used mostly with discover is in Local Time.

See Here ... Note I looked at the JSON

 ![Screenshot 2024-02-17 at 7.35.53 AM](https://us1.discourse-cdn.com/elastic/original/3X/f/3/f3380cf8e3c557009931fae8b452e91a94b62f63.jpeg)

Time Picker Local

 ![Screenshot 2024-02-17 at 7.37.45 AM](https://us1.discourse-cdn.com/elastic/original/3X/c/7/c7e70297ff038ac2cec815b9605df13d883976bd.jpeg)

If you want to see it all the same....  
Kibana -\> Stack Management -\> Advanced Settings -\> Time Zone  
Set the Kibana Time Zone to UTC

 ![Screenshot 2024-02-17 at 7.39.49 AM](https://us1.discourse-cdn.com/elastic/original/3X/5/0/50852245197e7b6403aa082312828ed5a81595b0.png)

 ![Screenshot 2024-02-17 at 7.40.12 AM](https://us1.discourse-cdn.com/elastic/original/3X/6/8/68ef740aa3e0bf4c451555b921555052926af472.jpeg)

---

<div class="post-metadata">

**Author:** ![Divya\_Kd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_kd/32/131830_2.png) [@Divya\_Kd](https://discuss.elastic.co/u/Divya_Kd)\
**Post date:** [February 20, 2024, 2:37pm UTC](https://discuss.elastic.co/t/discover-not-filtering-for-date-properly/353495/3 "2024-02-20T14:37:47Z")

</div>

Hi @stephenb Thank you for your response. Is there any way in kibana to add a day value to single click url in drilldown of kibana visualization? query:'{{date event.value "YYYY-MM-DD"}} +1d'

---

<div class="post-metadata">

**Author:** ![Divya\_Kd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_kd/32/131830_2.png) [@Divya\_Kd](https://discuss.elastic.co/u/Divya_Kd)\
**Post date:** [February 20, 2024, 3:28pm UTC](https://discuss.elastic.co/t/discover-not-filtering-for-date-properly/353495/4 "2024-02-20T15:28:32Z")

</div>

Also I am trying to get using login time and not using timestamp but still i guess there is issue. Weird part is the count I am getting in tsvb visualization doesnt consider this utc but discover does. So because of that my drill down shows a different count thatn the visualization. Currently I am looking for a way to send a range of date for Feb8,2024, I want to send gte as 2024-02-08 and lte and 2024-02-09 which brings proper count. But unfortunately I am unable to add a day to {{date even.value "YYYY-MM-DD"}}

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [February 20, 2024, 3:36pm UTC](https://discuss.elastic.co/t/discover-not-filtering-for-date-properly/353495/5 "2024-02-20T15:36:36Z")

</div>

> [@Divya\_Kd](#):
>
> Currently I am looking for a way to send a range of date for Feb8,2024, I want to send gte as 2024-02-08 and lte and 2024-02-09 which brings proper count. But unfortunately I am unable to add a day to {{date even.value "YYYY-MM-DD"}}

Apologies I am not sure I am following...

What version of Kibana?

Your trying to do a drill down with a URL but modify the date in the URL.... can you show... but in short I don't think you can do date math in the URL

There might be another way, but I'm not sure. Perhaps, you could create a runtime field that adds a date to the field... or perhaps you could do it in Lens, not TSVB?

Show more, please...

---

<div class="post-metadata">

**Author:** ![Divya\_Kd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_kd/32/131830_2.png) [@Divya\_Kd](https://discuss.elastic.co/u/Divya_Kd)\
**Post date:** [February 20, 2024, 7:52pm UTC](https://discuss.elastic.co/t/discover-not-filtering-for-date-properly/353495/6 "2024-02-20T19:52:44Z")

</div>

> [@stephenb](#):
>
> or perhaps you could do it in Len

So, @stephenb I am using Kibana version 7.17.7 and in my dashboard I am using a lens to show the number of users logged in my login time, and login status. In the drill down I am creating a single click URL to go to discover by passing login date as filter for discover and login status as another filter using {{date even.value}} and {{even.points[1].value}} . I would like to pass a gte and lte instead of filter using one single date. But as you mentioned I cannot do math in url is there any other way?

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/a/da2dc6091a2df0fc54388d2649f9deba74e85f2d.png)  
can i get these filter values in my url for to pass in my url?

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [February 20, 2024, 8:13pm UTC](https://discuss.elastic.co/t/discover-not-filtering-for-date-properly/353495/7 "2024-02-20T20:13:25Z")

</div>

Actually you should be able to...

Go to discover and set up the filters the way you want... Using the fields / filter you want..

Copy The Discover URL and Then use that URL as the template for the drill down URL and substitute the correct parameters... I think all the fields in docs are available... or maybe only the fields you split / aggregate by....

You can try filters or KQL then fill in the event data

I have done that in the past and it worked... If I am understanding correctly..

---

<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:** [March 19, 2024, 8:14pm UTC](https://discuss.elastic.co/t/discover-not-filtering-for-date-properly/353495/8 "2024-03-19T20:14:20Z")

</div>

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