# How to generalize the kibana visualization (bar chart)

**URL:** https://discuss.elastic.co/t/how-to-generalize-the-kibana-visualization-bar-chart/76480
**Category:** Kibana
**Created:** [February 25, 2017, 1:54pm UTC](https://discuss.elastic.co/t/how-to-generalize-the-kibana-visualization-bar-chart/76480 "2017-02-25T13:54:15Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![kiranilla](https://avatars.discourse-cdn.com/v4/letter/k/8e7dd6/32.png) [@kiranilla](https://discuss.elastic.co/u/kiranilla)
#### Post date: [February 25, 2017, 1:54pm UTC](https://discuss.elastic.co/t/how-to-generalize-the-kibana-visualization-bar-chart/76480/1 "2017-02-25T13:54:16Z")

</div>

In Kibana visualization (bar chart), i have created the bar chart for one of the index pattern (eg: Aircel), I have created the another index pattern (eg: Nationwide), having the similar columns for both index patterns with different data.

My Question is how can create a common visualization of Bar chart (called as bar chart template) so that it can be used for both 'Aircel' and 'Nationwide' indexes.

can you please help me on this. Thanks in advance.

---

<div class="post-metadata">

### Author: ![anhlqn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anhlqn/32/5454_2.png) [@anhlqn](https://discuss.elastic.co/u/anhlqn)
#### Post date: [February 25, 2017, 6:39pm UTC](https://discuss.elastic.co/t/how-to-generalize-the-kibana-visualization-bar-chart/76480/2 "2017-02-25T18:39:50Z")

</div>

> [@kiranilla](#):
>
> My Question is how can create a common visualization of Bar chart (called as bar chart template) so that it can be used for both 'Aircel' and 'Nationwide' indexes.

I don't think this is doable now.

If you have separate indexes, I think you can create alias for both indexes, and then add as an index pattern. After that, you can create a visualization for the new index pattern which can present data from both indexes.

- For Aircel, create alias `log-Aircel`
- For Nationwide, create alias `log-Nationwide`

Add a new index pattern `log-*` in Kibana, then create visualization for this index pattern.

---

<div class="post-metadata">

### Author: ![kiranilla](https://avatars.discourse-cdn.com/v4/letter/k/8e7dd6/32.png) [@kiranilla](https://discuss.elastic.co/u/kiranilla)
#### Post date: [February 27, 2017, 11:48am UTC](https://discuss.elastic.co/t/how-to-generalize-the-kibana-visualization-bar-chart/76480/3 "2017-02-27T11:48:01Z")

</div>

Thanks Anh..

I followed the steps as suggested by you.. it worked for me..  
I created the indexes as 'log-Aircel', 'log-Nationwide'  
and created a new index 'log-common' and ran the below script in 'Dev Tools' (left navigation link)

POST /\_aliases  
{  
"actions" : [  
{ "add" : { "index" : "log-Aircel", "alias" : "log-common" } },  
{ "add" : { "index" : "log-Nationwide", "alias" : "log-common" } }  
]  
}  
And created the visualizer 'month-aircel-nationwide' using the 'log-common'  
Able to see the data plotted for both (aircel , nationwide)  
Thanks for your help.

Is there any possibility that i can send an index type as a parameter so that it can draw only the specific index graph.  
Eg: I will be using the 'month-aircel-nationwide' visualizer, in this if i pass 'log-aircel' as a parameter then it should plot the data relevant to it.  
If is pass 'log-nationwide' as a parameter it should plot the data relavent to it.  
without modifying the 'month-aircel-nationwide' visualizer.

Could you please suggest me on this.  
Thanks for your help.

---

<div class="post-metadata">

### Author: ![kiranilla](https://avatars.discourse-cdn.com/v4/letter/k/8e7dd6/32.png) [@kiranilla](https://discuss.elastic.co/u/kiranilla)
#### Post date: [February 27, 2017, 11:51am UTC](https://discuss.elastic.co/t/how-to-generalize-the-kibana-visualization-bar-chart/76480/4 "2017-02-27T11:51:27Z")

</div>

[quote="kiranilla, post:3, topic:76480"]

**Thanks for your help Anh**

Is there any possibility that i can send an index type as a parameter so that it can draw only the specific index graph?  
Eg: I will be using the 'month-aircel-nationwide' visualizer, in this if i pass 'log-aircel' as a parameter then it should plot the data relevant to it.If is pass 'log-nationwide' as a parameter it should plot the data relavent to it.without modifying the 'month-aircel-nationwide' visualizer.

Could you please suggest me on this. Thanks in advance.

---

<div class="post-metadata">

### Author: ![anhlqn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anhlqn/32/5454_2.png) [@anhlqn](https://discuss.elastic.co/u/anhlqn)
#### Post date: [February 28, 2017, 3:33pm UTC](https://discuss.elastic.co/t/how-to-generalize-the-kibana-visualization-bar-chart/76480/5 "2017-02-28T15:33:58Z")

</div>

Since you create one single index pattern for both indexes, I think you put filter as a parameter that filter by the data type in each index. I hope the type field is different for each index, i.e., `"type": "aircel"` and `"type": "nationwide"`

> [@kiranilla](#):
>
> I followed the steps as suggested by you.. it worked for me.. I created the indexes as 'log-Aircel', 'log-Nationwide'and created a new index 'log-common' and ran the below script in 'Dev Tools' (left navigation link)
> 
> POST /\_aliases{ "actions" : [{ "add" : { "index" : "log-Aircel", "alias" : "log-common" } }, { "add" : { "index" : "log-Nationwide", "alias" : "log-common" } }]}

If you already used that two index names, creating a `log-*` index pattern in Kibana is good enough. There's no need for alias unless you want to do something else.

---

<div class="post-metadata">

### Author: ![kiranilla](https://avatars.discourse-cdn.com/v4/letter/k/8e7dd6/32.png) [@kiranilla](https://discuss.elastic.co/u/kiranilla)
#### Post date: [March 6, 2017, 8:03am UTC](https://discuss.elastic.co/t/how-to-generalize-the-kibana-visualization-bar-chart/76480/6 "2017-03-06T08:03:35Z")

</div>

**Thank you Anh... for your help**

I tried but i am not able to get the expected result.  
I tried putting the filters but i have ended with an error

 ![](https://us1.discourse-cdn.com/elastic/original/3X/4/1/41d2378faafe4333af3e124b5f462f43a5f21aba.JPG)

Please suggest on this:  
Is there any possibility that i can use query param in the url to indicate the index  
Eg: Below is the url which is being used to draw the above graph  
[http://localhost:5601/app/kibana#/visualize/edit/a6360410-fcca-11e6-bd1a-85777ea55e3f?\_g=](http://localhost:5601/app/kibana#/visualize/edit/a6360410-fcca-11e6-bd1a-85777ea55e3f?_g=)

can i use the "?index="log-nationwide" at the end of the url to get the required result.  
something which is shown below  
[http://localhost:5601/app/kibana#/visualize/edit/a6360410-fcca-11e6-bd1a-85777ea55e3f?index="log-nationwide"](http://localhost:5601/app/kibana#/visualize/edit/a6360410-fcca-11e6-bd1a-85777ea55e3f?index=%22log-nationwide%22)

Please suggest, thanks in advance

---

<div class="post-metadata">

### Author: ![anhlqn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anhlqn/32/5454_2.png) [@anhlqn](https://discuss.elastic.co/u/anhlqn)
#### Post date: [March 10, 2017, 5:04am UTC](https://discuss.elastic.co/t/how-to-generalize-the-kibana-visualization-bar-chart/76480/7 "2017-03-10T05:04:20Z")

</div>

The URL you post looks like a shortened URL. This is how it looks on my Kibana  
`http://localhost:5601/app/kibana#/visualize/edit/Free-disk-space-over-days?_g=(filters:!(('$$hashKey':'object:886','$state':(store:globalState),meta:(alias:!n,disabled:!f,index:'metricbeat-*',key:type,negate:!f,value:metricsets),query:(match:(type:(query:metricsets,type:phrase))))),refreshInterval:(display:'1%20minute',pause:!t,value:60000),time:(from:now-7d,mode:quick,to:now))&_a=(filters:!(),linked:!t,query:(query_string:(query:'*')),uiState:(),vis:(aggs:!((enabled:!t,id:'1',params:(field:system.fsstat.total_size.free),schema:metric,type:avg),(enabled:!t,id:'2',params:(customInterval:'2h',extended_bounds:(),field:'@timestamp',interval:d,min_doc_count:1),schema:segment,type:date_histogram)),listeners:(),params:(addLegend:!t,addTimeMarker:!f,addTooltip:!t,defaultYExtents:!f,legendPosition:right,mode:stacked,scale:linear,setYExtents:!f,shareYAxis:!t,times:!(),yAxis:()),title:'Free%20disk%20space%20over%20days',type:histogram))`

 ![](https://us1.discourse-cdn.com/elastic/original/3X/8/a/8a51dbd58602979b1eb9df173fccc32ca8bae6ee.PNG)

---

<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: [April 7, 2017, 5:04am UTC](https://discuss.elastic.co/t/how-to-generalize-the-kibana-visualization-bar-chart/76480/8 "2017-04-07T05:04:28Z")

</div>

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