Iframe Dashboard Filters

Hi, I have read a lot about this topic but could not get it to work.

The simple problem:
I want to include my dashboard in my own webapp. This works fine by using share->iframe.
Now I want to be able to specify filters/query in the iframe url so that the filters apply to the dashboard on loading.

As there is no documentation, what is the correct syntax for the URL (I tried so many things and it did not work :frowning:).

I am using Kibana 7.6.

My dashboard url (not the shared one) is:

http://localhost:15601/app/kibana#/dashboard/0b98b270-85db-11ea-bb8a-31c7626f733e?_a=(description:'',filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'3ba7f160-8081-11ea-bb8a-31c7626f733e',key:session_id,negate:!f,params:(query:'5ea0fa0e3b3af50001c9d080'),type:phrase),query:(match_phrase:(session_id:'5ea0fa0e3b3af50001c9d080'))),('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'3ba7f160-8081-11ea-bb8a-31c7626f733e',key:stage,negate:!f,params:(query:test),type:phrase),query:(match_phrase:(stage:test)))),fullScreenMode:!f,options:(hidePanelTitles:!f,useMargins:!f),panels:!((embeddableConfig:(),gridData:(h:16,i:'9ee02dfb-1820-44d5-89fa-daa971c45285',w:48,x:0,y:0),id:'4a6c0f50-8474-11ea-bb8a-31c7626f733e',panelIndex:'9ee02dfb-1820-44d5-89fa-daa971c45285',type:visualization,version:'7.6.1'),(embeddableConfig:(),gridData:(h:15,i:e50f6ee6-2fb2-4174-8657-4d61f24479bc,w:24,x:0,y:16),id:e56dad00-69c7-11ea-9f53-2bb6e65be0de,panelIndex:e50f6ee6-2fb2-4174-8657-4d61f24479bc,type:visualization,version:'7.6.1'),(embeddableConfig:(),gridData:(h:15,i:'241b4b79-ed3b-44e8-8bd5-9502cbe66e5f',w:24,x:24,y:16),id:'6f5b0b00-73d4-11ea-bb8a-31c7626f733e',panelIndex:'241b4b79-ed3b-44e8-8bd5-9502cbe66e5f',type:visualization,version:'7.6.1'),(embeddableConfig:(),gridData:(h:15,i:'82bf4a7c-cd67-45cf-b0d7-d753b8e76a74',w:24,x:0,y:31),id:'5ed019e0-8173-11ea-bb8a-31c7626f733e',panelIndex:'82bf4a7c-cd67-45cf-b0d7-d753b8e76a74',type:visualization,version:'7.6.1'),(embeddableConfig:(),gridData:(h:14,i:da1add6f-9d56-4a91-a2de-7229a2490cf0,w:24,x:24,y:31),id:'4780f3c0-81f7-11ea-bb8a-31c7626f733e',panelIndex:da1add6f-9d56-4a91-a2de-7229a2490cf0,type:visualization,version:'7.6.1')),query:(language:kuery,query:''),timeRestore:!f,title:'Session%20results%20-%20no%20controls',viewMode:view)&_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))

The url from the generated iframe code (by share->embed_code-> saved_object) is:

http://localhost:15601/app/kibana#/dashboard/0b98b270-85db-11ea-bb8a-31c7626f733e?embed=true&_g=(filters%3A!()%2CrefreshInterval%3A(pause%3A!t%2Cvalue%3A0)%2Ctime%3A(from%3Anow-15m%2Cto%3Anow))

I have seen someone using something like

_a=...

but I could not get it to work. Please if some can just simply tell me the correct syntax to use to specify just a simple filter or a list of filters.

Thanks

Hello @tonyskulk,

Filter state is stored in the url. If you create a dashboard that has the filters you desire and then generate the embedded code you should have whaat you need.

--Matt

Hello @mattkime,

thanks for your response.
I want to update the filters depending on my webapp´s state: Lets say a user is allowed to select a session_id in my webapp and then I want the iframe-linked dashboard to show only data filtered according to this session_id.
So I must be able to dynamically update the url and I dont know how this works. I assume I have to use the _a request parameter but I really can not understand the syntay. Maybe can someone give me an example working with Kibana 7.6 please?

Many thanks in advance,
Tony

Hello @tonyskulk,

You're correct. You'll find what you're looking for in the _g param. I recommend making a small change to your dashboard (such as applying a filter) and then diffing the url to see how its changed. Here's code thats involved in generating such urls - src/plugins/dashboard/public/url_generator.ts

Hope this helps,
Matt

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