Canvas data filtering

My use case for Canvas is all about counting documents and visualizing how many documents that meet different criteria. In almost all cases, I want to count the total number of documents that match some criteria, and show that together wit the count of a further filtering of the total set of matched documents.

Example:

Let's say that I have an index with documents that have the attributes "State" and "ReviewRecord". I want to show in i line chart the total number of documents that match the query "State: Accepted" as well as the number of documents that match the query "State: Accepted AND ReviewRecord: *", i.e. show the count of accepted documents that have a review record in relation to the total number of accepted documents.

This is easy with filters in regular Kibana visualizations, but I can't figure out a way to do this in Canvas.

Any suggestions?

1 Like

There are a couple ways to do this. First you could add a dropdown filter element to the workpad (if you want to be able to change it on the fly). Otherwise in your datasource, depending on what you're using, you can set a query on the data there.

image

I can do one query in the datasource, e.g. "State: Accepted", but in my use case I need a second query "State: Accepted AND ReviewRecord: *". I need to show both in the same chart so that I can display how they relate to each other. In a more generic use case I need N filter queries in the datasource.

As I explained, this is easy with regular Kibana visualizations, but in Canvas I'm limited to one single query.

Or if I go with the filter element on the workpad to filter "State: Accepted", I still need two queries on the datasource: "*" and "ReviewRecord: *", so that doesn't work either. I still need to be able to make multiple filters in the datasource.

Think of it as a chart with "Total" and "Filtered":

Total:    XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Filtered: XXXXXXXXXXXXXXXXX
          0           100           200
1 Like

Have you tried entering this entire query in the datasource query?

State:Accepted AND ReviewRecord:*

That query would give me this:

Filtered: XXXXXXXXXXXXXXXXX
          0           100           200

I also need "Total", i.e. the "State: Accepted" part.

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