Create a table where the columns change depending on which fields exist for the data returned (given filters and searches)


So in my index pattern objects* has multiple different object types within it that all have their own fields.


Object 1: type=house, id=0, color=blue, size=2000, city=Portland)
Object 2: type=car, id=1, color=black, wheel-size=10, speed=10, owner=George)
Object 3: type=bike, id=2, wheel-size=3, age-range=child)

So, the objects* Index Pattern has fields: type, id, color, size, city, wheel-size, speed, owner, age-range.

For this index pattern, I need to make a table visualization inside a Kibana dashboard where the columns shown in the table vary automatically to include only the fields present in the current data. To clarify, if a user of the dashboard uses the KQL search bar (or a control built in to my dashboard) to filter the data by type.keyword=car, then my table visualization has the columns: type, id, color, wheel-size, speed, owner shown. Now, if the user decides to filter by both car and bike objects, the table would automatically update to show the columns: type, id, color, wheel-size, speed, owner, age-range.

Is there any way to do this in a Kibana dashboard? My hunch is that there might be way to do it using Vega, but I haven't been able to find anything online.

Thank you!