# Customizing Time Filter Quick Ranges in Kibana: dynamicly adapat based on a specific time

**URL:** <https://discuss.elastic.co/t/customizing-time-filter-quick-ranges-in-kibana-dynamicly-adapat-based-on-a-specific-time/347485>\
**Category:** Kibana\
**Created:** [November 19, 2023, 8:03pm UTC](https://discuss.elastic.co/t/customizing-time-filter-quick-ranges-in-kibana-dynamicly-adapat-based-on-a-specific-time/347485 "2023-11-19T20:03:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Behnam.R](https://avatars.discourse-cdn.com/v4/letter/b/48db29/32.png) [@Behnam.R](https://discuss.elastic.co/u/Behnam.R)\
**Post date:** [November 19, 2023, 8:03pm UTC](https://discuss.elastic.co/t/customizing-time-filter-quick-ranges-in-kibana-dynamicly-adapat-based-on-a-specific-time/347485/1 "2023-11-19T20:03:40Z")

</div>

I'm looking to customize Kibana's Time Filter Quick Ranges with a specific date math expression and need advice on feasibility and syntax. The expression I want to use is:

```auto
{
  "from": "((now-6h)/d)+6h",
  "to": "now",
  "display": "current operation"
}

```

The goal is to start the range 6 hours ago, rounded to the start of the day, plus 6 hours, ending now:

```auto
now>=06:00 => 06:00 today to now
now<06:00 => 06:00 yesterday to now

```

I have tried this and kibana return no result for the chosen custom timefram. I'm unsure if this complexity is achievable in Kibana's date math.

Could anyone guide me on:

1. The possibility of implementing this expression.
2. The correct syntax, if feasible.
3. Alternatives for setting such a specific time range.

Thanks for any insights!

---

<div class="post-metadata">

**Author:** ![Priscilla\_Parodi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/priscilla_parodi/32/43047_2.png) [@Priscilla\_Parodi](https://discuss.elastic.co/u/Priscilla_Parodi)\
**Post date:** [November 20, 2023, 6:15pm UTC](https://discuss.elastic.co/t/customizing-time-filter-quick-ranges-in-kibana-dynamicly-adapat-based-on-a-specific-time/347485/2 "2023-11-20T18:15:41Z")

</div>

Hello @Behnam.R,

Are you using Kibana Discover? What is the version?

> [@Behnam.R](#):
>
> The possibility of implementing this expression.

You can edit the filter as a query DSL and then use a `range` query with the `timestamp` field.

 ![Screen Shot 2023-11-20 at 1.10.15 PM](https://us1.discourse-cdn.com/elastic/original/3X/a/3/a37877fecb723c340c4af099ede0f8c7d783dc69.jpeg)

> **[Range query | Elasticsearch Guide \[8.11\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html#ranges-on-dates)**

---

<div class="post-metadata">

**Author:** ![Priscilla\_Parodi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/priscilla_parodi/32/43047_2.png) [@Priscilla\_Parodi](https://discuss.elastic.co/u/Priscilla_Parodi)\
**Post date:** [November 20, 2023, 6:17pm UTC](https://discuss.elastic.co/t/customizing-time-filter-quick-ranges-in-kibana-dynamicly-adapat-based-on-a-specific-time/347485/3 "2023-11-20T18:17:53Z")

</div>

> [@Behnam.R](#):
>
> - The correct syntax, if feasible.
> - Alternatives for setting such a specific time range.

Assuming that I understood correctly, and in this case, your query would be similar to this one:

 ![Screen Shot 2023-11-20 at 1.09.31 PM](https://us1.discourse-cdn.com/elastic/original/3X/9/5/95fdf59ec7f117211b229de4a5b7d19ec722280b.png)

Where "now-6h/d" gets the current time minus six hours, rounded to the start of the day +6h.

---

<div class="post-metadata">

**Author:** ![Behnam.R](https://avatars.discourse-cdn.com/v4/letter/b/48db29/32.png) [@Behnam.R](https://discuss.elastic.co/u/Behnam.R)\
**Post date:** [November 21, 2023, 7:38am UTC](https://discuss.elastic.co/t/customizing-time-filter-quick-ranges-in-kibana-dynamicly-adapat-based-on-a-specific-time/347485/4 "2023-11-21T07:38:15Z")

</div>

@Priscilla_Parodi , I am using the kibana 8.6.1. And I want to have this timerange option for all the dashboards. But thanks for the input, I was using then the wrong date math syntax, now I have added your timestamp field in the Advance setting in kibana and it works fine.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/4/6442da08a51e4341c4540f8e3ae5fc004887c354.png)

---

<div class="post-metadata">

**Author:** ![Priscilla\_Parodi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/priscilla_parodi/32/43047_2.png) [@Priscilla\_Parodi](https://discuss.elastic.co/u/Priscilla_Parodi)\
**Post date:** [November 21, 2023, 2:50pm UTC](https://discuss.elastic.co/t/customizing-time-filter-quick-ranges-in-kibana-dynamicly-adapat-based-on-a-specific-time/347485/5 "2023-11-21T14:50:28Z")

</div>

Thanks for the context. You’re welcome!

---

<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 19, 2023, 2:50pm UTC](https://discuss.elastic.co/t/customizing-time-filter-quick-ranges-in-kibana-dynamicly-adapat-based-on-a-specific-time/347485/6 "2023-12-19T14:50:40Z")

</div>

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