How to selective apply filters on one of the plots in a Visualization

The usecase is as follows:

Imagine data with X axis = Some Term, Y axis = Some data point, and each entry in the database has a date time value.

Something like ('A', 5, 2017-08-01) , ('B', 6, '2018-08-01) , ('A', 3, 2017-08-02) , ('B', 4, '2018-08-02)

I want to plot two lines, one for date 2018-08-01, one for 2018-08-02 in the same visualization. The lines will be plotted against 'A' and 'B' on the X axis.

I want the user of the dashboard to be able to provide these as input (filter inputs).

How can I most easily achieve this?

I think something like this will get you pretty close to what you want.

It's a bit more of a natural step to use the date in the X-Axis, because Y axis is usually for metric aggregations like sum or count, and the Y-axis is usually for bucket aggregations like date histogram.

I made a bunch of test data using ('A', 5, 2017-08-01) as an example. I call the first field "code", the second field "scans" and the third field "date". Then I created a test index with a bunch of documents like:

POST /mytest/doc
{
  "code": "B",
  "date": "2017-08-01",
  "scans": 10
}

Using Kibana 6.2.2, I create a line chart visualization to show a sum metric of all the scans bucketed by date:

The line can be divided by the "code" field using a terms aggregation:

Finally we can put in a filter by clicking "Add a filter" and walking the dialog through to:

Filter: code.keyword is one of A B

So, if I want to change the code filter to add C or have it just show A, then I can click the pencil icon to edit the filter and adjust it.

The icons on the filter "pill" also allow me to toggle the filter off, invert it, or pin it so it sticks and gets carried over to other visualizations and dashboards

One more thing I want to share. In Kibana 6.1.0, an experimental visualization called input controls was released that allows an easy way to make filters that choose from items in a terms aggregation and it will affect other visualizations in the dashboard.

I can create an input control visualization like this:

And then put both visualizations on a dashboard:

Now the box on the right has a drop-down which allows me to create easy filters that affect the line chart visualization. These filters can also be toggled an pinned just like any other filter:

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