# How to Make a Custom Date Range in a Kibana Visualization?

**URL:** <https://discuss.elastic.co/t/how-to-make-a-custom-date-range-in-a-kibana-visualization/27378>\
**Category:** Kibana\
**Created:** [August 14, 2015, 7:54am UTC](https://discuss.elastic.co/t/how-to-make-a-custom-date-range-in-a-kibana-visualization/27378 "2015-08-14T07:54:01Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![GordonM](https://avatars.discourse-cdn.com/v4/letter/g/977dab/32.png) [@GordonM](https://discuss.elastic.co/u/GordonM)\
**Post date:** [August 14, 2015, 7:54am UTC](https://discuss.elastic.co/t/how-to-make-a-custom-date-range-in-a-kibana-visualization/27378/1 "2015-08-14T07:54:01Z")

</div>

I am trying to have a visualization (simple bar graph with a date histogram) display data in a date range with some date math applied, but when I try to add the appropriate JSON Input to the query, the query fails with a “failed to find start object” parse error.  
Here is a sample of what I am trying to do, taken from the [date format](https://www.elastic.co/guide/en/elasticsearch/guide/current/_ranges.html) page.

```
{
  "range" : {
    "my_time_stamp" : {
        "gt" : "now-1h"
    }
  }
}

```

I checked the request and this is being merged into the “aggs” section of the json request, which is the wrong section.

I have been able to get JSON input to recognize things like a custom "min\_doc\_count" which is correctly merged:

```
{
	“min_doc_count”: 1
}

```

I don’t know if this can be done easily with the Kibana GUI (please let me know if it can)  
My hope is to have a dashboard that has visualizations that cover different date ranges. From my explorations so far, it seems that a dashboard’s visualizations all must have the same date range. (Please tell me if there is an easier way to do this! I have a feeling I am going about this the wrong way since it seems like a simple thing to do.)

---

<div class="post-metadata">

**Author:** ![GordonM](https://avatars.discourse-cdn.com/v4/letter/g/977dab/32.png) [@GordonM](https://discuss.elastic.co/u/GordonM)\
**Post date:** [August 14, 2015, 10:18am UTC](https://discuss.elastic.co/t/how-to-make-a-custom-date-range-in-a-kibana-visualization/27378/2 "2015-08-14T10:18:59Z")

</div>

I was able to use date math in a raw json query submitted on the Discover page. This restricts data to the specified date range in a visualization, but the visualization still scales with a the dashboard's time interval setting (so it will zoom way out at 5 years and way in at Today, and this will still carve my query results up and distort visualization graphs). Is there a way to "lock in" the correct visualization zoom for a visualization on a dashboard?

(And anyway to do any of these easier than a raw json query?)

---

<div class="post-metadata">

**Author:** ![tbragin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tbragin/32/45166_2.png) [@tbragin](https://discuss.elastic.co/u/tbragin)\
**Post date:** [August 14, 2015, 5:22pm UTC](https://discuss.elastic.co/t/how-to-make-a-custom-date-range-in-a-kibana-visualization/27378/3 "2015-08-14T17:22:33Z")

</div>

You might be looking for this enhancement: [https://github.com/elastic/kibana/issues/3578](https://github.com/elastic/kibana/issues/3578)

---

<div class="post-metadata">

**Author:** ![GordonM](https://avatars.discourse-cdn.com/v4/letter/g/977dab/32.png) [@GordonM](https://discuss.elastic.co/u/GordonM)\
**Post date:** [August 16, 2015, 7:30am UTC](https://discuss.elastic.co/t/how-to-make-a-custom-date-range-in-a-kibana-visualization/27378/4 "2015-08-16T07:30:14Z")

</div>

Yes, that is what I am looking for! I see it is not tagged to a milestone though, unfortunately. Is it something we might see in Kibana 4? Having a single dashboard to be able to compare data from time X to time Y would be a great addition. Even better (as the submitter of the enhancement further asked) would to be able to compare it in the same visualization.

Currently, it seems comparisons like

```
this month compared to this month last year (or day, year, week, etc.)

```

cannot be done in a single dashboard (or visualization) in Kibana. This makes the task of looking at data and seeing relevant growth patterns over time require using an alternative program to graph ES data.

---

<div class="post-metadata">

**Author:** ![tbragin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tbragin/32/45166_2.png) [@tbragin](https://discuss.elastic.co/u/tbragin)\
**Post date:** [August 17, 2015, 3:46pm UTC](https://discuss.elastic.co/t/how-to-make-a-custom-date-range-in-a-kibana-visualization/27378/5 "2015-08-17T15:46:48Z")

</div>

We're definitely working toward something in this regard... more info to come soon, stay tuned!

---

<div class="post-metadata">

**Author:** ![yahoo](https://avatars.discourse-cdn.com/v4/letter/y/898d66/32.png) [@yahoo](https://discuss.elastic.co/u/yahoo)\
**Post date:** [March 2, 2016, 5:38pm UTC](https://discuss.elastic.co/t/how-to-make-a-custom-date-range-in-a-kibana-visualization/27378/6 "2016-03-02T17:38:39Z")

</div>

Hi @tbragin  
Is it possible now to construct a dashboard with multiple visualizations each for a different time range. For example: one month starting a one month ago, two months ago, or one month a year ago ?

---

<div class="post-metadata">

**Author:** ![vikalp](https://avatars.discourse-cdn.com/v4/letter/v/e47c2d/32.png) [@vikalp](https://discuss.elastic.co/u/vikalp)\
**Post date:** [April 13, 2016, 11:20am UTC](https://discuss.elastic.co/t/how-to-make-a-custom-date-range-in-a-kibana-visualization/27378/7 "2016-04-13T11:20:16Z")

</div>

hi yahoo,

Can you tell me how i can do the for a line chart one for today another for last week

---

<div class="post-metadata">

**Author:** ![yahoo](https://avatars.discourse-cdn.com/v4/letter/y/898d66/32.png) [@yahoo](https://discuss.elastic.co/u/yahoo)\
**Post date:** [April 13, 2016, 11:13pm UTC](https://discuss.elastic.co/t/how-to-make-a-custom-date-range-in-a-kibana-visualization/27378/8 "2016-04-13T23:13:01Z")

</div>

Hi @vikalp  
I was not able to make it.  
Any clue from your side?

---

<div class="post-metadata">

**Author:** ![vikalp](https://avatars.discourse-cdn.com/v4/letter/v/e47c2d/32.png) [@vikalp](https://discuss.elastic.co/u/vikalp)\
**Post date:** [April 14, 2016, 7:14am UTC](https://discuss.elastic.co/t/how-to-make-a-custom-date-range-in-a-kibana-visualization/27378/9 "2016-04-14T07:14:06Z")

</div>

I am able to do in timelion but not in kibana.  
business want both in single dashboard,  
so looking for a solution either do it in kibana  
or integrate timelion graph in kibana dashboard.

---

<div class="post-metadata">

**Author:** ![alainc](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@alainc](https://discuss.elastic.co/u/alainc)\
**Post date:** [April 18, 2016, 10:54pm UTC](https://discuss.elastic.co/t/how-to-make-a-custom-date-range-in-a-kibana-visualization/27378/10 "2016-04-18T22:54:19Z")

</div>

in kb 4.5 you can integrate timelion series inside kibana but the filterinside timelion does not use the filtering topbar of kibana right now

> [@Timelion timeseries in kibana visualise](https://discuss.elastic.co/t/timelion-timeseries-in-kibana-visualise/45971/2):
>
> Correct, the timelion visualization does not currently play nice with Kibana filters. I've got a ticket on it, just trying to decide on implementation: [https://github.com/elastic/timelion/issues/80](https://github.com/elastic/timelion/issues/80)

---

<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 6, 2017, 1:55pm UTC](https://discuss.elastic.co/t/how-to-make-a-custom-date-range-in-a-kibana-visualization/27378/11 "2017-07-06T13:55:42Z")

</div>


