# Restore KQL time filter on Kibana Dashboard

**URL:** <https://discuss.elastic.co/t/restore-kql-time-filter-on-kibana-dashboard/287975>\
**Category:** Kibana\
**Created:** [October 29, 2021, 7:41am UTC](https://discuss.elastic.co/t/restore-kql-time-filter-on-kibana-dashboard/287975 "2021-10-29T07:41:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pranay\_jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pranay_jain/32/92747_2.png) [@pranay\_jain](https://discuss.elastic.co/u/pranay_jain)\
**Post date:** [October 29, 2021, 7:41am UTC](https://discuss.elastic.co/t/restore-kql-time-filter-on-kibana-dashboard/287975/1 "2021-10-29T07:41:19Z")

</div>

Is there a way to restore time filter selection on Kibana dashboard.

**Use case :**

We have menu button on our web page from where we open Kibana dashboard by using tokens with the endpoint /internal/security/login for logging.

Once the dashboard opens it has the default the time selection i.e last 1 year.  
If a users wants to search data for a particular time window they can change the time filter accordingly. Later, when the use reopens the dashboard by clicking on the menu button the time filter is again set to 1 year.

Thus every time user has to change the time selection.

**Expected behavior** :  
The last time filter of the user must be restored when the user opens the dashboard.

Is there a way to handle this correctly?

---

<div class="post-metadata">

**Author:** ![cheiligers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cheiligers/32/73114_2.png) [@cheiligers](https://discuss.elastic.co/u/cheiligers)\
**Post date:** [October 29, 2021, 9:31pm UTC](https://discuss.elastic.co/t/restore-kql-time-filter-on-kibana-dashboard/287975/2 "2021-10-29T21:31:29Z")

</div>

Hi @pranay_jain It sounds like you're looking for a way to set a _personalized_ time-filter and at the moment you have a couple of options:

1. It sounds like the Dashboard itself was saved with a time range and you could remove that or save a new one without a time filter to allow users to keep their own selection.
2. Users could also save their own copy of the dashboard along with their preferred time range. Note that you'll end up having many copies of the same Dashboard that might get out of synch though.  
3 Probably the better alternative is to ask user to [save a query](https://www.elastic.co/guide/en/kibana/7.15/save-load-delete-query.html) that contains their chosen time filter. I don't know what version you're using, so the link is to the docs for the 7.15 version (you can change the version in the docs)

For options 2 and 3, please note that dashboards and saved queries are available to _everyone_ in a Space so each user would have to save their Dashboard/query as as descriptively as possible (e.g. MyName\_DashboardABC/MyName\_DashboardABC\_TimeFilter)

I hope that helps!

---

<div class="post-metadata">

**Author:** ![pranay\_jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pranay_jain/32/92747_2.png) [@pranay\_jain](https://discuss.elastic.co/u/pranay_jain)\
**Post date:** [November 8, 2021, 10:43am UTC](https://discuss.elastic.co/t/restore-kql-time-filter-on-kibana-dashboard/287975/3 "2021-11-08T10:43:59Z")

</div>

Hi @cheiligers, thank you for your response.  
What I am trying to achieve is to restore the last time filter when the user reopens the Kibana dashboard on the browser.  
I was trying for option #1, where I tried removing the time filters while saving the dashboard.  
As a result, I removed the attributes "timeFrom":"now-1y/d" and "timeTo":"now" from the dashboard object (.ndjson file).  
Now, when I open the updated dashboard on Kibana, the time filter is always set to last 15 minutes by default. I tried changing it for e.g to last 90 days, close the browser and reopen the dashboard but it resets to 15 minutes.  
On the other hand, the time filter selection restores correctly as long as the Kibana browser tab is not closed completely.  
Can you please suggest?

---

<div class="post-metadata">

**Author:** ![cheiligers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cheiligers/32/73114_2.png) [@cheiligers](https://discuss.elastic.co/u/cheiligers)\
**Post date:** [November 8, 2021, 3:20pm UTC](https://discuss.elastic.co/t/restore-kql-time-filter-on-kibana-dashboard/287975/4 "2021-11-08T15:20:21Z")

</div>

Hi @pranay_jain The only way to restore a user's "previously used" time filter at the moment is for each users to save the dashboard after they've set their chosen time filter.  
If the dashboard is a shared object, each user will need to save their own copy (use the "Save as" option on the top right) so that they don't override the 'main' dashboard and other users' filters:

 ![Screen Shot 2021-11-08 at 08.18.38](https://us1.discourse-cdn.com/elastic/original/3X/9/9/999578153363dd9d930f9af35794475d269d28b2.png)  
 ![Screen Shot 2021-11-08 at 08.19.48](https://us1.discourse-cdn.com/elastic/original/3X/e/0/e047d5b09a82ec8608739a54dd261cb8fdb6685a.png)

---

<div class="post-metadata">

**Author:** ![pranay\_jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pranay_jain/32/92747_2.png) [@pranay\_jain](https://discuss.elastic.co/u/pranay_jain)\
**Post date:** [November 9, 2021, 9:42am UTC](https://discuss.elastic.co/t/restore-kql-time-filter-on-kibana-dashboard/287975/5 "2021-11-09T09:42:27Z")

</div>

Ok thank you !

---

<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:** [December 7, 2021, 9:42am UTC](https://discuss.elastic.co/t/restore-kql-time-filter-on-kibana-dashboard/287975/6 "2021-12-07T09:42:54Z")

</div>

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