# Filter Visualizations on a Dashboard using the default time range (dashboard upper right corner) on filter conditions using fields other than index pattern primary time field

**URL:** <https://discuss.elastic.co/t/filter-visualizations-on-a-dashboard-using-the-default-time-range-dashboard-upper-right-corner-on-filter-conditions-using-fields-other-than-index-pattern-primary-time-field/278209>\
**Category:** Kibana\
**Created:** [July 8, 2021, 5:22pm UTC](https://discuss.elastic.co/t/filter-visualizations-on-a-dashboard-using-the-default-time-range-dashboard-upper-right-corner-on-filter-conditions-using-fields-other-than-index-pattern-primary-time-field/278209 "2021-07-08T17:22:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![fefontana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fefontana/32/62843_2.png) [@fefontana](https://discuss.elastic.co/u/fefontana)\
**Post date:** [July 8, 2021, 5:22pm UTC](https://discuss.elastic.co/t/filter-visualizations-on-a-dashboard-using-the-default-time-range-dashboard-upper-right-corner-on-filter-conditions-using-fields-other-than-index-pattern-primary-time-field/278209/1 "2021-07-08T17:22:32Z")

</div>

Hi, is it possible to have a multiple "Time Field" index pattern ?.  
I would like to use the default time filter in a dashboard to filter dynamically 3 visualizations this way:

Index pattern time field = field1\*  
Dashboard time filter: 01/05/2021 - now = mainFilter

Visualization1 filter: field1\* between mainFilter  
Visualization2 filter: field2 between mainFilter  
Visualization3 filter: field3 between mainFilter

Is this possible ?. Any workaround ?.

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [July 9, 2021, 2:42pm UTC](https://discuss.elastic.co/t/filter-visualizations-on-a-dashboard-using-the-default-time-range-dashboard-upper-right-corner-on-filter-conditions-using-fields-other-than-index-pattern-primary-time-field/278209/2 "2021-07-09T14:42:38Z")

</div>

I think there are two options here:

1. Create three different index patterns with field1, field2 and field3 as default time field and build your visualization with the "correct" one. You can't really give them nice names, a hack I used a bunch of times is to add a second index name to the pattern which doesn't get matched and serves as a comment. Like if your indices are called `mydata-*`, then name it `mydata-*,(field1 based)`, `mydata-*,(field2 based)` and so on. It will match the same actual indices, but you see right away what it's about
2. If your visualizations contain a date histogram, consider using the Lens visualization type. it will actually do this automatically - if you use a time field which is not the default for a date histogram it will bind the main filter to that field instead of the default time field. For visualizations without date histogram this won't work, it will fall back to the default time field.

---

<div class="post-metadata">

**Author:** ![fefontana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fefontana/32/62843_2.png) [@fefontana](https://discuss.elastic.co/u/fefontana)\
**Post date:** [July 13, 2021, 8:28pm UTC](https://discuss.elastic.co/t/filter-visualizations-on-a-dashboard-using-the-default-time-range-dashboard-upper-right-corner-on-filter-conditions-using-fields-other-than-index-pattern-primary-time-field/278209/3 "2021-07-13T20:28:52Z")

</div>

Hi, thank you for your answer.  
In option 1. Can you explain what you mean when you say "add a second index name to the pattern which doesn't get matched" ?. Do I need to create another index copy of the original and duplicate data ?.

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [July 14, 2021, 12:15pm UTC](https://discuss.elastic.co/t/filter-visualizations-on-a-dashboard-using-the-default-time-range-dashboard-upper-right-corner-on-filter-conditions-using-fields-other-than-index-pattern-primary-time-field/278209/4 "2021-07-14T12:15:33Z")

</div>

I was just refering to the `,(field 1 based)` suffix to the index pattern. Elasticsearch allows to list multiple indices separated by comma for a pattern definition (`index1, index2`), option 1 is abusing this for putting a comment in there for an index name that will never be matched. You don't need a separate copy of your data.

---

<div class="post-metadata">

**Author:** ![fefontana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fefontana/32/62843_2.png) [@fefontana](https://discuss.elastic.co/u/fefontana)\
**Post date:** [July 14, 2021, 7:48pm UTC](https://discuss.elastic.co/t/filter-visualizations-on-a-dashboard-using-the-default-time-range-dashboard-upper-right-corner-on-filter-conditions-using-fields-other-than-index-pattern-primary-time-field/278209/5 "2021-07-14T19:48:24Z")

</div>

Thank you Joe, just to conclude this thread, I've implemented the two options, and all worked fine.

Main index: mock\_sms

**Option1:**  
Defining 3 Index Patterns this way (without spaces after comma):

mock\_sms\*,fecha ─────────► fecha default Time field in index pattern  
mock\_sms\*,fechaRespuesta ──► fechaRespuesta default Time field in index pattern  
mock\_sms,fechaRecepcion ───►fechaRecepcion default Time field in index pattern

then I've implemented 3 different visualizations, each one pointing to each of previous index patterns. Finally, I loaded the three visualizations in a new dashboard. Now, every time the default date in the dashboard is changed, also change the date scale in the three visualizations at the same time.

**Option2:**  
I've implemented three visualizations, each one with the three date fields above using Lens:  
Visualization1 - X Axis: fecha  
Visualization2 - X Axis: fechaRecepcion  
Visualization3 - X Axis: fechaRespuesta

and loaded in a new dashboard. The dashboard behaves the same as in Option1.  
The only drawback in Option2 is Lens does not allow too many customizations in visualizations. For example: [Change format of labels in a visualization X axis chart](https://discuss.elastic.co/t/change-format-of-labels-in-a-visualization-x-axis-chart/265131)  
Perhaps Lens needs more time to get more customization features.

---

<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:** [August 11, 2021, 7:48pm UTC](https://discuss.elastic.co/t/filter-visualizations-on-a-dashboard-using-the-default-time-range-dashboard-upper-right-corner-on-filter-conditions-using-fields-other-than-index-pattern-primary-time-field/278209/6 "2021-08-11T19:48:47Z")

</div>

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