# Filter bar not working in canvas

**URL:** <https://discuss.elastic.co/t/filter-bar-not-working-in-canvas/255698>\
**Category:** Kibana\
**Created:** [November 17, 2020, 12:52pm UTC](https://discuss.elastic.co/t/filter-bar-not-working-in-canvas/255698 "2020-11-17T12:52:50Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![borisllona](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/borisllona/32/79163_2.png) [@borisllona](https://discuss.elastic.co/u/borisllona)\
**Post date:** [November 17, 2020, 12:52pm UTC](https://discuss.elastic.co/t/filter-bar-not-working-in-canvas/255698/1 "2020-11-17T12:52:51Z")

</div>

I am creating a canvas and I want a Time Filter bar to select a specific date and all my elements from the canvas to adapt to that new time range.  
How can I do that? I have just added a filter bar in my canvas where are the rest of elements and when I select an specific date nothing happens.

Thank you in advance

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [November 19, 2020, 7:24pm UTC](https://discuss.elastic.co/t/filter-bar-not-working-in-canvas/255698/2 "2020-11-19T19:24:34Z")

</div>

Most Canvas expressions start with `filters | ...` for this reason. You can also group filters by assigning them a group ID, and then use `filters groupName="name" | ` to have different filters for different elements.

---

<div class="post-metadata">

**Author:** ![borisllona](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/borisllona/32/79163_2.png) [@borisllona](https://discuss.elastic.co/u/borisllona)\
**Post date:** [November 20, 2020, 1:46pm UTC](https://discuss.elastic.co/t/filter-bar-not-working-in-canvas/255698/3 "2020-11-20T13:46:36Z")

</div>

Yes, I know that you can do that if you work with queries, but if you are using a savedvisualization, there is a mandatory field that says timerange that if you put a filter before it, i think it overrides the value.

savedVisualization id="45ce8f50-240a-11eb-b321-2d4230c55aff" **timerange={timerange from="now-2d" to="now"}**  
| render

Then, how do I have to do it to apply a filterBar group to those savedVisualizations and make it work with that instad of the timerange?

Thank you very much

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [November 20, 2020, 3:37pm UTC](https://discuss.elastic.co/t/filter-bar-not-working-in-canvas/255698/4 "2020-11-20T15:37:50Z")

</div>

I asked the Canvas team about this. You are required to provide a timerange to the `savedVisualization`, but the `filters` are also including a time range. These time ranges will get applied together using AND, so you can intersect the time ranges.

---

<div class="post-metadata">

**Author:** ![borisllona](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/borisllona/32/79163_2.png) [@borisllona](https://discuss.elastic.co/u/borisllona)\
**Post date:** [November 20, 2020, 4:13pm UTC](https://discuss.elastic.co/t/filter-bar-not-working-in-canvas/255698/5 "2020-11-20T16:13:49Z")

</div>

Mmmm sounds good but I still don't see the way to implement it working.  
Would be so nice if you could make a small tutorial on how to combine filter bars and saveobjects since there are not on the internet.

Thanks again!

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [November 20, 2020, 4:16pm UTC](https://discuss.elastic.co/t/filter-bar-not-working-in-canvas/255698/6 "2020-11-20T16:16:47Z")

</div>

It's just `filters | savedVisualization timerange={...}`

---

<div class="post-metadata">

**Author:** ![borisllona](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/borisllona/32/79163_2.png) [@borisllona](https://discuss.elastic.co/u/borisllona)\
**Post date:** [November 24, 2020, 5:49pm UTC](https://discuss.elastic.co/t/filter-bar-not-working-in-canvas/255698/7 "2020-11-24T17:49:06Z")

</div>

Nop, not working, my code is the following:

| filters mygroup  
| savedVisualization id="45ce8f50-240a-11eb-b32-2d4230c55aff" timerange={timerange from="now-2d" to="now"}  
| render

I think first applies the filtergroup from the time filter bar but then it is overwrited by the timerange property which can't be deleted.

Thanks and sorry for bothering.

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [November 24, 2020, 6:04pm UTC](https://discuss.elastic.co/t/filter-bar-not-working-in-canvas/255698/8 "2020-11-24T18:04:09Z")

</div>

As long as the column is set correctly on your time range, this will work. For example:

```auto
timefilterControl compact=true column="order_date" filterGroup="mygroup"
| render

```

```auto
filters "mygroup"
| savedVisualization id="4b3ec120-b892-11e8-a6d9-e546fe2bba5f" timerange={timerange from="now-7d" to="now"}
| render

```

This works as expected.

---

<div class="post-metadata">

**Author:** ![borisllona](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/borisllona/32/79163_2.png) [@borisllona](https://discuss.elastic.co/u/borisllona)\
**Post date:** [November 24, 2020, 6:35pm UTC](https://discuss.elastic.co/t/filter-bar-not-working-in-canvas/255698/9 "2020-11-24T18:35:39Z")

</div>

Works with @timestamp ? Because the x-axis of my Visualization is based on that and I have the same as you but: column="@timestamp" which makes sense for me, but still not getting the expected result.

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [November 24, 2020, 6:53pm UTC](https://discuss.elastic.co/t/filter-bar-not-working-in-canvas/255698/10 "2020-11-24T18:53:51Z")

</div>

If you change your time range in your filter, the results of the visualization should change- for example, you can choose non-overlapping time ranges and see no results. This is the easiest way to verify.

---

<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 22, 2020, 6:53pm UTC](https://discuss.elastic.co/t/filter-bar-not-working-in-canvas/255698/11 "2020-12-22T18:53:54Z")

</div>

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