# Visualization from two indexes

**URL:** https://discuss.elastic.co/t/visualization-from-two-indexes/210308
**Category:** Kibana
**Created:** [December 3, 2019, 8:49am UTC](https://discuss.elastic.co/t/visualization-from-two-indexes/210308 "2019-12-03T08:49:26Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![ugi.bugi](https://avatars.discourse-cdn.com/v4/letter/u/b5ac83/32.png) [@ugi.bugi](https://discuss.elastic.co/u/ugi.bugi)
#### Post date: [December 3, 2019, 8:49am UTC](https://discuss.elastic.co/t/visualization-from-two-indexes/210308/1 "2019-12-03T08:49:26Z")

</div>

Hello ElasticTeam,

I have two indexes and I want to make one visualization from it.

First index looks like:  
Id,  
Timespan,  
Date,  
LineType.

Second index looks like:  
Id,  
Timespan,  
Date,  
LineType,  
Genre,  
Description,  
RaportingUser.

I want to create visualization like on image below:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/a/2ab0ca9b341090f2869f3618d4e67fcab2307cbe.png)  
The visualization should only show data from current shift in factory. Can it be made with Kibana?

Is it even possible to do that ? Should I merge data to one index or go on with two separated?

Thanks for all responses,  
Lukasz

---

<div class="post-metadata">

### Author: ![ArisP](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arisp/32/58381_2.png) [@ArisP](https://discuss.elastic.co/u/ArisP)
#### Post date: [December 3, 2019, 1:59pm UTC](https://discuss.elastic.co/t/visualization-from-two-indexes/210308/2 "2019-12-03T13:59:01Z")

</div>

Hi Lukasz, in Kibana you'll work with index patterns. You can combine the two indices in an index pattern: [https://www.elastic.co/guide/en/kibana/current/index-patterns.html](https://www.elastic.co/guide/en/kibana/current/index-patterns.html)

---

<div class="post-metadata">

### Author: ![ugi.bugi](https://avatars.discourse-cdn.com/v4/letter/u/b5ac83/32.png) [@ugi.bugi](https://discuss.elastic.co/u/ugi.bugi)
#### Post date: [December 9, 2019, 8:00am UTC](https://discuss.elastic.co/t/visualization-from-two-indexes/210308/3 "2019-12-09T08:00:01Z")

</div>

Hello Aris,

Thank you for response, it helped me a lot.  
I have another questions now.  
My timespan column I mentioned before has its values in miliseconds. Is it possible to divide its values so I have minutes on my visualization? If yes, where can I do that?  
Also, is it possible to have my visualization change its filters automatically at particular hours ? Visualized data has to be from current shift in factory, for example from between 2 P.M to 10 P.M, and at 10 P.M it should change its filters to take only data from between 10 P.M to 6 A.M.  
I hope I explained everything clearly 🙂

Thanks in advance,  
Lukasz

---

<div class="post-metadata">

### Author: ![ArisP](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arisp/32/58381_2.png) [@ArisP](https://discuss.elastic.co/u/ArisP)
#### Post date: [December 9, 2019, 1:54pm UTC](https://discuss.elastic.co/t/visualization-from-two-indexes/210308/4 "2019-12-09T13:54:19Z")

</div>

Glad it was of help 🙂 For the first part, you may want to use scripted fields (assuming you prefer not to pre-process the data): [https://www.elastic.co/guide/en/kibana/current/scripted-fields.html](https://www.elastic.co/guide/en/kibana/current/scripted-fields.html). For the second part, you basically need scheduled activation/deactivation of filters in a visualisation?

---

<div class="post-metadata">

### Author: ![ugi.bugi](https://avatars.discourse-cdn.com/v4/letter/u/b5ac83/32.png) [@ugi.bugi](https://discuss.elastic.co/u/ugi.bugi)
#### Post date: [December 9, 2019, 5:14pm UTC](https://discuss.elastic.co/t/visualization-from-two-indexes/210308/5 "2019-12-09T17:14:14Z")

</div>

Thank you v.much again, scripted fields will do the work 🙂  
I need my filters to change at particular hours.  
For example:  
Between 10 P.M and 6 A.M I need my filters to get only data which is from between 10 P.M to 6 A.M, then, starting at 6 A.M to 2 P.M I need my filters to get only data which is from between 6 A.M and 2 P.M. Then, starting at 2 P.M to 10 P.M I need my filters to get only data which is from between 2 P.M to 10 P.M.  
This is like workers have their shifts at factory.  
Is there a way to change filters or should I make 3 separated visualizations:

- One with first type of filter (10 P.M - 6 A.M),
- Second with second type of filter (6 A.M - 2 P.M),
- Third one with (2 P.M - 10 P.M)  
And just switch between them at that particular hours ?

I also have another problem which I cant solve.  
I have a metric visualization of my data, currently it has 2 metrics like on the image below:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/3/a3a005308c1bc798960e5f122df64c072eb96af0.png)  
I have to create one more metric, it has to show percentage share of "Metric Sum of odpad" in "Metric Sum of ilosc" (these two metrics are on the image).  
The mathematical formula for this would be like:  
NewMetricValue = ("Metric Sum of odpad" / "Metric Sum of ilosc") \* 100;  
How can I achieve that on my visualization ??

Thanks,  
Lukasz

---

<div class="post-metadata">

### Author: ![ugi.bugi](https://avatars.discourse-cdn.com/v4/letter/u/b5ac83/32.png) [@ugi.bugi](https://discuss.elastic.co/u/ugi.bugi)
#### Post date: [December 15, 2019, 2:15pm UTC](https://discuss.elastic.co/t/visualization-from-two-indexes/210308/6 "2019-12-15T14:15:22Z")

</div>

Hello again,

If there's no response should I recognize that things that I mentioned before are impossible to do and look for some kind of workaround?

Edit 2019-12-16 1:32PM:  
I solved problem with displaying that percentage share by creating TSVB chart.

Best regards,  
Lukasz

---

<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: [January 12, 2020, 2:15pm UTC](https://discuss.elastic.co/t/visualization-from-two-indexes/210308/7 "2020-01-12T14:15:27Z")

</div>

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