Where condition

Hi,
as a beginner on Kibana this question might be silly, but I cannot get across it:

I would like to add a stacked bar graph to my dashboard.

Two Y-axis:

  1. sum of index abc field1, where field2="1"
  2. sum of index abc field1, where field2="2"

Sum of abc field1 is easy. But how can I accomplish the where conditions?
The page filter (upper left corner) would solve for one Y-axis, but not for my request of two Y-Axis.

Using Kibana 7.10 OSS.

An example on how to use it in the GUI would be appreciated.
If an advanced JSON is necessary, please advise on how to integrate it into the GUI.

Many thanks,
Wolfram

This can be done, i guess, using a filter aggregation
You can add multiple filters, each one with a custom label, but in X- axis
Is this something that can help you ?
Or may be TSVB builder is more suitable for your use case with filters on Y-axis

image

Hi Yassine,
thanks for your quick reply. I think, your solution is not sufficient, as it will apply to both Y-Axis.
But I need to distinguish between both.
Can you explain in more detail please?

Thanks, Wolfram

I would not expect you to visualize this data using two Y-axes: it distorts the relationship between A and B. The approach that @ylasri suggested is what I would use as well.

You can use TSVB to get two Y axes with separate filters. You can create a second series using the + button next to the name of the series. Each one can take a custom filter and have its own axis. But again, I do not recommend this based on your description of the problem.

Hi wylie,
yes, it does make sense. I need to see on a single graph two options. This is not destorting the relationship between A and B, as the data are closely related.
What is TSVB???

Thanks,
Wolfram

TSVB is one of the buttons that appears in the list when you create a visualization in Kibana...

Sorry I want to use vertical bar.

Yes, that is a TSVB feature.

So you basically tell me a simple where condition cannot be integrated within vertical bar? I will have a look into TSVB.. will let you know next days.
Anyway,
Thanks, Wolfram

You can use the Filters aggregation in the Vertical bar chart, but you will get one Y axis. To get two Y axes you need to use TSVB.

I can add a second Y-Axis with vertical bars as well... but I cannot achieve to have different sum-ups ... (well the where conditions makes the problem) ... sooo easy to solve with SQL.

The good news is that about a week ago, we merged the work needed to get a filtered metric into Lens. Filtered metrics will let you do 2 Y axes with separate filters. It is targeted for the next minor, which is 7.13

Wylie, your are kidding :slight_smile: Be prepared for my next question, that is targeting the same direction, but a bit more sophisticated.
Thanks Wolfram

Hi, short feedback:
Yes I got my primary issue solved with TSVB.

Many thanks,
Wolfram

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