Applying kibana filter to Vega-lite visualization with url.body.query set

Hi, I'm having an issue with Kibana dashboard filter (" + Add filter " option located at the top left corner) isn't applied to a vega-lite visualization.
Here is an example, visualization is using URL to fetch data from Elasticsearch with a body containing query and aggregation parts. That being said, the query part looks like this:

"query": {
          "bool": {
            "must": [
              "%dashboard_context-must_clause%",
              {
                "range": {
                  "eventTime": {"%timefilter%": true}
                }
              }
            ],
            "must_not": ["%dashboard_context-must_not_clause%"],
            "filter": [
              {
                "term": {"status": 0} 
              }
            ]
          }
        }

This gives me:


If I apply the filter nothing changes ???

If you inspect some random request from Kibana being sent towards elastic, you can see that filer is contained inside filter part of the query.bool:


I've tried putting "%dashboard_context-filter_clause%"

"query": {
          "bool": {
            "must": [
              "%dashboard_context-must_clause%",
              {
                "range": {
                  "eventTime": {"%timefilter%": true}
                }
              }
            ],
            "must_not": ["%dashboard_context-must_not_clause%"],
            "filter": [
            "%dashboard_context-filter_clause%",  <-- **THIS LINE HERE** !!!
              {
                "term": {"status": 0} 
              }
            ]
          }
        }

(a wild guess, don't know if that really exists) but that didn't work.

So, bottom line, how can I get Kibana dashboard filter to apply to vega-lite as it does for other types of data visualizations?
Thanks.

Nobody knows this? I really hope that this can be solved somehow because putting a panel on the dashboard that can't handle filtering is a major deal breaker.

Hello,
Can you try with the %context%: true parameter as well? Configuring the control panel with vega visualization

Hi Marius, thanks for your replay. No, I can't use %conteext%:true because I have a url.body.query set :frowning:

I wouldn't want for this topic to be automatically closed (after 28 days of inactivity) so I'm asking @nyuriks if maybe he can help with this? I would really appreciate it. If you need any additional info I'm here.
Thanks in advance

@Josip_Cagalj thx for the report. I suspect this to be a bug. In theory, you shouldn't need anything beyond the dashboard_context-must_clause and dashboard_context-must_not_clause entries when you use your own query param, but perhaps internally filtering does something new, and I may need to introduce a new value for that. Could you create a github issue with your example and kibana version? thx!

Thank you, for fast response and for the suggestion to open a GitHub issue which I did here.
Keeping a close eye on this.

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