# TSVB terms visualization

**URL:** https://discuss.elastic.co/t/tsvb-terms-visualization/269843
**Category:** Kibana
**Created:** [April 12, 2021, 7:32am UTC](https://discuss.elastic.co/t/tsvb-terms-visualization/269843 "2021-04-12T07:32:28Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![oshtman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oshtman/32/78031_2.png) [@oshtman](https://discuss.elastic.co/u/oshtman)
#### Post date: [April 12, 2021, 7:32am UTC](https://discuss.elastic.co/t/tsvb-terms-visualization/269843/1 "2021-04-12T07:32:28Z")

</div>

Hi,  
I'm fairly new to Kibana and I'm attempting to setup a visualization where I have fields of the form  
("my\_field\_name" + "custom\_part"):  
`my_field_name_custom_part1=true`  
`my_field_name_custom_part1=false`  
... etc  
What I want to achieve is to be able to group the field by terms and apply a filter only showing the count of desired variants of the field (e.g. I only want to visualize all occurrences of my\_field\_custom\_part1).

However, grouping by terms in e.g. a TSVB table and later applying a filter in the dashboard only appears to allow sorting by either "count" or "asc/desc" order of the field which terms was applied to. Is there any way to limit the table results to only show `my_field_custom_part1`?  
Note: The fields I want to filter on are selected from a custom drop down list

I'm not sure if its clear what I want to achieve but shoot me any questions if not 😃

---

<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: [April 15, 2021, 7:43am UTC](https://discuss.elastic.co/t/tsvb-terms-visualization/269843/2 "2021-04-15T07:43:16Z")

</div>

I'm not 100% sure about the visualization you want to achieve, but using the "Aggregation based" visualization types it's possible to order the terms by a custom metric and you can use a metric based on any field in there. Does that help?

I think screenshots of the current state of your dashboard and a description of what you want to change would help me understanding your case.

In general, it's not possible to dynamically aggregate multiple fields based on a common name prefix in Kibana - you always have to pick the field to operate on. There are some ways around this, for example you could ingest a single document per dynamic part - instead of

```auto
{
  my_field_name_custom_part1: true,
  my_field_name_custom_part2: true
}

```

you could do

```auto
{ key: "my_field_name_custom_part1", value: true }
{ key: "my_field_name_custom_part2", value: true }

```

---

<div class="post-metadata">

### Author: ![oshtman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oshtman/32/78031_2.png) [@oshtman](https://discuss.elastic.co/u/oshtman)
#### Post date: [April 19, 2021, 12:40pm UTC](https://discuss.elastic.co/t/tsvb-terms-visualization/269843/3 "2021-04-19T12:40:42Z")

</div>

Hi, and thanks for your initial reply.  
Re-structuring the data as you suggested did help with setting up most of the desired visualizations.  
Regarding the ordering however, I do use filter ratios in TSVB. As it appears, filter ratios are not available in visualizations created from the "Aggregation" list. Is there any other way to ensure I only display what the global filter is currently set to? Seems like a pretty standard thing and I'm sure its possible somehow, maybe I'm just coming at the problem from the wrong direction.  
Some images that might help:

Dropdown selecting desired field experiments.key.name as filter:  
 ![Skärmavbild 2021-04-19 kl. 14.37.30](https://us1.discourse-cdn.com/elastic/original/3X/d/3/d3d167e38a46b6efc1b0f88e6aa640f300f99824.png)

Table created with TSVB using filter ratios, which ignores my gobal filter of expriments.key.name. Should show: "new\_design" entry only  
 ![Skärmavbild 2021-04-19 kl. 14.37.45](https://us1.discourse-cdn.com/elastic/original/3X/b/d/bd149a33474b4f03562815cd88be65c23e82c32a.png)

---

<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: [April 20, 2021, 9:25am UTC](https://discuss.elastic.co/t/tsvb-terms-visualization/269843/4 "2021-04-20T09:25:58Z")

</div>

I see, if you need filter ratios TSVB is the right choice at the moment.

TSVB visualizations should respect the global filter on dashboards. Is it possible there is a single document containing multiple values for for `experiments.key`? Keep in mind that Elasticsearch is flattening out nested objects, so a document like this

```auto
experiments: [
{ key: "new_promotion_pitch", value: 4 },
{ key: "new_design", value: 7 },
]

```

is interpreted like this in aggregations:

```auto
experiments.key: ["new_promotion_pitch", "new_design"],
experiments.value: [4, 7]

```

So it's not tying the key to the value in nested objects. To visualize that, the individual experiments should be separate documents.

---

<div class="post-metadata">

### Author: ![oshtman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oshtman/32/78031_2.png) [@oshtman](https://discuss.elastic.co/u/oshtman)
#### Post date: [April 20, 2021, 10:25am UTC](https://discuss.elastic.co/t/tsvb-terms-visualization/269843/5 "2021-04-20T10:25:26Z")

</div>

That was actually the miss on my side, and the cause of the ordering not working as expected.  
Thanks again for your help!

---

<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: [May 18, 2021, 10:26am UTC](https://discuss.elastic.co/t/tsvb-terms-visualization/269843/6 "2021-05-18T10:26:10Z")

</div>

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