Selective Filtering In Visualizations Using Scripted Fields


(Patricia Sauer) #1

Hi all,

I wanted to apply filters to only some visualizations. Those visualizations are using scripted fields and as far as I know I cannot search for scripted fields. When trying to search for scripted fields I was not successful but when searching for non-scripted fields everything was fine. So I guess that it's not my fault.
When putting some visualizations to one dashboard, filters will be applied to all visualizations. Because of scripted fields being non-searchable I cannot save a search and use it for specific visualizations. I thought that the "Advanced" area in the "Visualize" tab could maybe be used but I'm not sure. I really don't know for what the JSON Input in the "Advanced" area could be used.
Can anyone make a guess how to apply filters to only some visualizations and not to the whole dashboard?

Thanks


(Shaunak Kashyap) #2

Hi,

The "Advanced" area in the Visualize tab is used in the aggregation part of the Elasticsearch request. You can supply a JSON object here and that object will get merged into the corresponding aggregation section in the request to Elasticsearch. This, unfortunately, will not help you achieve what you are trying to do — filter using scripted fields.

Filtering can only be performed on fields that are actually indexed in Elasticsearch. Scripted fields aren't actually indexed in Elasticsearch; when you use them in Kibana, it simply substitutes the scripted field reference with its definition before making the query to Elasticsearch.

So for filtering different visualizations in different ways, the only other option I can think of is to reindex your data, setting the previously-scripted fields as actual fields in your documents at index time. Then you can create visualizations, filter them with these fields, and save them. Adding them to the dashboard will "carry over" the visualizations' filters along with the visualization.


(system) #3