Filtering different visualizations in the same dashboard differently

Assume I have an index of employees, each with a sub-object representing their manager:

{
	"document-id": "XYZ",
	"firstName": "John",
	"lastName": "Smith",
	"office": "midtown",
	"manager": {
		"document-id": "ABC",
		"firstName": "Sue",
		"lastName": "Smith",
		"office": "downtown"
	}
}

I want a dashboard with two metrics - the number of employees, and the number of managers. Easy enough - create one Metric visualization with a simple Count of documents in the index, and another Metric visualization with a Unique Count of manager.document-id.

But now what if I want to be able to filter my dashboard by "office", to see how many employees and managers I have in each office? I can't create a simple dropdown, because one Metric needs to filter based on "office", while the other needs to filter based on "manager.office".

Is there a way to do this - to have a filter apply differently to the different visualizations in a single dashboard? Perhaps some sort of parameterized visualization?

I'm using Kibana 7.4.2.
And assume that it is not feasible to create another index of just managers. Both of these entities are actually much more complicated, with many more sub-objects, than I'm representing here, so creating even more indexes with such [duplicated] complexity seems inadvisable.

Thanks!

I see two things:

  • On one hand Kibana understands filters as a composition and logical conditions.
  • Even if you could reindex your data to have a new field with the two values, unfortunately, Kibana does not support nested fields (reported issue), so no widget can operate on that type of data.

At this moment I'd say you need to use the Kibana bar to execute the or operation.

@flash1293 any other ideas?, please correct me if I'm wrong.

1 Like

I think even an or query wouldn't help here, because it would count employees if just the manager is located in an office and vice versa.

Splitting up this index into a manager index and an employee index indeed seems like the "right" approach here.

If it's not necessary to dynamically choose the office, you can also add the respective filters to individual visualizations ("number of employees in location X", "number of managers in location X", "number of employees in location Y", "number of managers in location Y")

2 Likes

Thanks. Not quite the answer I was hoping for, but at least it's good to know I'm not missing some way to simplify things.

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