# How to apply different filter for different column in a single Kibana visualisation (Data Table)?

**URL:** https://discuss.elastic.co/t/how-to-apply-different-filter-for-different-column-in-a-single-kibana-visualisation-data-table/58817
**Category:** Kibana
**Created:** [August 24, 2016, 12:14pm UTC](https://discuss.elastic.co/t/how-to-apply-different-filter-for-different-column-in-a-single-kibana-visualisation-data-table/58817 "2016-08-24T12:14:02Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![pramod\_kumar](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@pramod\_kumar](https://discuss.elastic.co/u/pramod_kumar)
#### Post date: [August 24, 2016, 12:14pm UTC](https://discuss.elastic.co/t/how-to-apply-different-filter-for-different-column-in-a-single-kibana-visualisation-data-table/58817/1 "2016-08-24T12:14:02Z")

</div>

Hi All,

I have created 2 index say **a-b-middletier** and **a-b-database** upon that i have created a kibana visualisation (Data Table) by merging these 2 indexes say **a-b-** \*. i would like to see the counts w.r.t middletier and database with the label say **count\_for\_middletier** and **count\_for\_database**.

**Expected result:**  
**Name**** count\_for\_database ****count\_for\_middletier**  
middletier -/0 100  
database 100 -/0

**But am getting the following:**

**Name**** count\_for\_database ****count\_for\_middletier**  
middletier 100 100  
database 100 100

It would be very helpful, if you can help me on how to put different filters on counts(aggregation fields) ??

And also can we have different filter on different aggregate columns example count, sum, average..??

Thanks  
Pramod

---

<div class="post-metadata">

### Author: ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)
#### Post date: [August 24, 2016, 5:58pm UTC](https://discuss.elastic.co/t/how-to-apply-different-filter-for-different-column-in-a-single-kibana-visualisation-data-table/58817/2 "2016-08-24T17:58:22Z")

</div>

Hi Pramod,

There might be other ways to do this, but I found a way to get those counts only for specific indexes (not wildcarded);  
I have packetbeat and topbeat running. I created an index pattern `*beat-*` which is what I've used in this Data Table visualization. I Split Rows on a Filters aggregation type, and added 2 filters;  
`_index: topbeat-2016.08.24`  
and  
`_index: packetbeat-2016.08.24`

 ![](https://us1.discourse-cdn.com/elastic/original/2X/6/68e996ffec95e64c3f082a69b88c7d853fe098d5.png)

Regards,  
Lee

Also see [https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-index-field.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-index-field.html)  
which describes that \_index is a virtual field. It's not something that is an actual indexed field in the docs.

---

<div class="post-metadata">

### Author: ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)
#### Post date: [August 24, 2016, 6:52pm UTC](https://discuss.elastic.co/t/how-to-apply-different-filter-for-different-column-in-a-single-kibana-visualisation-data-table/58817/3 "2016-08-24T18:52:07Z")

</div>

I found another way that doesn't require using the exact index names but it's a bit more hacky.

1. Create a visualization Split Rows on Terms, and pick any string type of field.
2. Save that visualization
3. go to Settings \> Objects \> Visualization tab and click on the visualization you just saved
4. go down to the visState and replace that string field from step 1 with `_index`
5. Save your changes
6. You can get directly to your visualization by clicking the eye icon next to your visualization name

 ![](https://us1.discourse-cdn.com/elastic/original/2X/d/d2139c955402e1159152e54a7f84d5decb4aebe2.png)

One issue with this is that when you look at the Data tab for the visualization it shows a blank for the `Field` because `_index` isn't in the list so it can't show that selection. This technique will find all indexes that match your current index pattern, but it's not going to group them by their type like a-b-middletier or a-b-database (I'm assuming you have time-based indexes).

 ![](https://us1.discourse-cdn.com/elastic/original/2X/c/cd2a08f91d37b4966c832c90a25b6cf3112a12bb.png)

I think is the same issue as with `_type` and I'll comment on this issue;

> <https://github.com/elastic/kibana/issues/5684>

Regards,  
Lee

---

<div class="post-metadata">

### Author: ![pramod\_kumar](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@pramod\_kumar](https://discuss.elastic.co/u/pramod_kumar)
#### Post date: [August 24, 2016, 6:52pm UTC](https://discuss.elastic.co/t/how-to-apply-different-filter-for-different-column-in-a-single-kibana-visualisation-data-table/58817/4 "2016-08-24T18:52:34Z")

</div>

Thanks a lot for the help LeeDr.

I would like to tell you the whole scenario, so that you can help me resolving this issue in particular.  
I have 2 index, one for database and another for weblogic.  
I will be getting 2 different set of fields i.e one set for middletier and the other for database right and there are few common fields like name and version among both.

Example: Lets assume you got 2 products product 1 and 2 with some version, both product have some middletier and database events you want to list(count). can you Please help me how to resolve this issue ??

I would like to see 4 following columns (expected).  
Name Version count(middletier) count(database)  
product\_1 1.1 25 20  
product\_2 1.2 34 12

It will be really very helpful, if you can help me resolving this issue.

Thanks  
Pramod

---

<div class="post-metadata">

### Author: ![pramod\_kumar](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@pramod\_kumar](https://discuss.elastic.co/u/pramod_kumar)
#### Post date: [August 24, 2016, 6:56pm UTC](https://discuss.elastic.co/t/how-to-apply-different-filter-for-different-column-in-a-single-kibana-visualisation-data-table/58817/5 "2016-08-24T18:56:18Z")

</div>

yes, this is time based indexing.

Thanks  
Pramod

---

<div class="post-metadata">

### Author: ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)
#### Post date: [August 24, 2016, 7:07pm UTC](https://discuss.elastic.co/t/how-to-apply-different-filter-for-different-column-in-a-single-kibana-visualisation-data-table/58817/6 "2016-08-24T19:07:11Z")

</div>

Hi Pramod,

I don't understand the rest of your question regarding "different filters on counts(aggregation fields)". Could you explain more?

Thanks,  
Lee

---

<div class="post-metadata">

### Author: ![pramod\_kumar](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@pramod\_kumar](https://discuss.elastic.co/u/pramod_kumar)
#### Post date: [August 24, 2016, 7:26pm UTC](https://discuss.elastic.co/t/how-to-apply-different-filter-for-different-column-in-a-single-kibana-visualisation-data-table/58817/7 "2016-08-24T19:26:01Z")

</div>

Sure, please let me know if you any doubt, i will narrate with some other example, but please help me with this issue.

assume we are working on 2 different product with different versions.

Example: Lets assume we have 4 indexes  
a-b-database-product\_x [Fields =\> name, version,....]  
a-b-database-product\_y [Fields =\> name, version,....]  
a-b-middletier-product\_x [Fields =\> name, version,....]  
a-b-middletier-product\_y [Fields =\> name, version,....]

with some common fields (name and version) among all 4 indexes.  
so here product\_1 will have both middletier and database events (index: a-b-database-product\_x, a-b-middletier-product\_x)  
hence the product\_1 has count of 25 for middletier and 20 for the the database right, so for product\_y ?

If i use the index as a-b-\* in the kibana visualisation (very specifically Data Table), i would expect the following to appear.

I would like to see 4 following columns (expected).

```
Name Version count(middletier) count(database)

```

product\_x 1.1 25 20  
product\_y 1.2 34 12

It will be really very helpful, if you can help me resolving this issue.??  
please let me know if you have any doubt.

Thanks  
Pramod

---

<div class="post-metadata">

### Author: ![pramod\_kumar](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@pramod\_kumar](https://discuss.elastic.co/u/pramod_kumar)
#### Post date: [August 24, 2016, 7:47pm UTC](https://discuss.elastic.co/t/how-to-apply-different-filter-for-different-column-in-a-single-kibana-visualisation-data-table/58817/8 "2016-08-24T19:47:54Z")

</div>

I hope you got my question by now, otherwise please let me know.([pramodkumar.cu@gmail.com](mailto:pramodkumar.cu@gmail.com))

Thanks in advance  
Pramod

---

<div class="post-metadata">

### Author: ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)
#### Post date: [August 24, 2016, 7:48pm UTC](https://discuss.elastic.co/t/how-to-apply-different-filter-for-different-column-in-a-single-kibana-visualisation-data-table/58817/9 "2016-08-24T19:48:19Z")

</div>

Hi Pramod,

If you followed along with my previous steps and have a Data Table which has a terms aggregation on \_index, then you should click to "Add sub-buckets" under that and again select Terms, version.

It won't lay it out exactly as you have shown like a spreadsheet. Instead it will have one column for all counts, and the rows will be for each unique set of the aggregations you have.

Thanks,  
Lee

---

<div class="post-metadata">

### Author: ![pramod\_kumar](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@pramod\_kumar](https://discuss.elastic.co/u/pramod_kumar)
#### Post date: [August 24, 2016, 7:53pm UTC](https://discuss.elastic.co/t/how-to-apply-different-filter-for-different-column-in-a-single-kibana-visualisation-data-table/58817/10 "2016-08-24T19:53:54Z")

</div>

Can't we have multiple count columns in one Data Table (kibana Visualisation) and specific filter for each column say count(middletier) or count(database)??

I was thinking, can we do this with JSON input under advanced option ??

Thanks  
Pramod

---

<div class="post-metadata">

### Author: ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)
#### Post date: [August 24, 2016, 7:57pm UTC](https://discuss.elastic.co/t/how-to-apply-different-filter-for-different-column-in-a-single-kibana-visualisation-data-table/58817/11 "2016-08-24T19:57:19Z")

</div>

The current Data Table visualization doesn't support that. There's at least one enhancement request asking for it;

> <https://github.com/elastic/kibana/issues/3620>

---

<div class="post-metadata">

### Author: ![pramod\_kumar](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@pramod\_kumar](https://discuss.elastic.co/u/pramod_kumar)
#### Post date: [August 24, 2016, 8:02pm UTC](https://discuss.elastic.co/t/how-to-apply-different-filter-for-different-column-in-a-single-kibana-visualisation-data-table/58817/12 "2016-08-24T20:02:00Z")

</div>

If JSON input is the solution, could you tell me how to put filter for some regex inside the JSON input ?

 ![](https://us1.discourse-cdn.com/elastic/original/2X/e/e3b5a51dd7b4ffc2fbcf7d0d4b9e5b449b963c11.png) ![](https://us1.discourse-cdn.com/elastic/original/2X/2/2d0fd463b0beb2fbaeaea0269f515b54de0e135e.png)

Thanks  
Pramod

---

<div class="post-metadata">

### Author: ![pramod\_kumar](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@pramod\_kumar](https://discuss.elastic.co/u/pramod_kumar)
#### Post date: [August 24, 2016, 8:03pm UTC](https://discuss.elastic.co/t/how-to-apply-different-filter-for-different-column-in-a-single-kibana-visualisation-data-table/58817/13 "2016-08-24T20:03:35Z")

</div>

Any Idea, when will that enhancement will be delivered to customers ??

Thanks  
Pramod

---

<div class="post-metadata">

### Author: ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)
#### Post date: [August 24, 2016, 8:07pm UTC](https://discuss.elastic.co/t/how-to-apply-different-filter-for-different-column-in-a-single-kibana-visualisation-data-table/58817/14 "2016-08-24T20:07:33Z")

</div>

No estimate. It doesn't seem that hard, but I'm not a developer familiar with that code.

---

<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:40pm UTC](https://discuss.elastic.co/t/how-to-apply-different-filter-for-different-column-in-a-single-kibana-visualisation-data-table/58817/15 "2017-07-06T13:40:23Z")

</div>


