Set vizualisation filter in iframe URL of dashboard


Context :

I have 5 visualizations. All of them got AGG like AVG, and at least one bucket to split datas :

  • For one user : foobar
  • For all the users
    With this visualizations we can compare AVG of one user to the AVG of all others.

OK - everything work. The magic "share embeded" give us an iframe with URL, and in the URL, we have the filter in plain text like "input:(query:(query_string:.... foobar))"

We wrote a small proxy in nodejs which change the filter with the connected user (simple replace) and all our user can compare themself with the AVG of all the user.

My problem :
How can I put this 5 viz in an embedded dashboard and still getting access to each filter of the viz through the iframe URL ?
Of course, I tried to moodify the query of the dashboard, but quite logicaly the AVG of the connected user is equals to the AVG of ALL user.

Best regards

PS : That's the last break point for us one our POC to choose Kibana.

HI Sebastian

This is not something we would support. You can change the iframe in your code and you can use javascript to change it dynamically if needed, but this is not something we will build into Kibana. As an alternative you could try and put each embedded visualization into a page, rather than a dashboard , it would work.
This would be a good opportunity for an enhancement request in Kibana repo.


I think the problem you're having can be explained by looking at the 2 ways of embedding a visualization iframe.

In this screenshot of the Sharing panel in a visualization on the left side we have the embedded iframe for the saved visualization. It uses the guid of the saved visualization. This URL does not contain my filter string "init" (representing your user "foobar"). That filter string is saved in the visualization itself. If you used this iframe and I made a change to the visualization you would see the change. This iframe link is 318 characters long.

<iframe src="https://localhost:5601/app/kibana#/visualize/edit/abe2c120-1f87-11e7-a7cc-fbe9a87ddb8f?embed=true&_g=(refreshInterval%3A(display%3AOff%2Cpause%3A!f%2Cvalue%3A0)%2Ctime%3A(from%3A'2017-04-11T18%3A41%3A25.557Z'%2Cmode%3Aabsolute%2Cto%3A'2017-04-11T18%3A42%3A01.198Z'))" height="600" width="800"></iframe>

On the right side we see Share Snapshot Embedded iframe. This URL builds the matching visualization instead of referencing the visualization saved in the Kibana index. The URL does contain my filter string "init" and a proxy could modify it. This iframe link is 1807 characters long.

<iframe src="https://localhost:5601/app/kibana#/visualize/edit/abe2c120-1f87-11e7-a7cc-fbe9a87ddb8f?embed=true&_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:'2017-04-11T18:41:25.557Z',mode:absolute,to:'2017-04-11T18:42:01.198Z'))&_a=(filters:!(),linked:!f,query:(query_string:(analyze_wildcard:!t,query:'*')),uiState:(spy:(mode:(fill:!f,name:table))),vis:(aggs:!((enabled:!t,id:'1',params:(,schema:metric,type:avg),(enabled:!t,id:'2',params:(customInterval:'2h',extended_bounds:(),field:'@timestamp',interval:auto,min_doc_count:1),schema:segment,type:date_histogram),(enabled:!t,id:'3',params:(filters:!((input:(query:(query_string:(analyze_wildcard:!t,query:''))),label:''),(input:(query:(query_string:(analyze_wildcard:!t,query:'*')))))),schema:group,type:filters)),listeners:(),params:(addLegend:!t,addTimeMarker:!f,addTooltip:!t,categoryAxes:!((id:CategoryAxis-1,labels:(show:!t,truncate:100),position:bottom,scale:(type:linear),show:!t,style:(),title:(text:'@timestamp+per+second'),type:category)),defaultYExtents:!f,drawLinesBetweenPoints:!t,grid:(categoryLines:!f,style:(color:%23eee)),interpolate:linear,legendPosition:right,radiusRatio:9,scale:linear,seriesParams:!((data:(id:'1',label:''),drawLinesBetweenPoints:!t,interpolate:linear,lineWidth:2,mode:normal,show:!t,showCircles:!t,type:line,valueAxis:ValueAxis-1)),setYExtents:!f,showCircles:!t,times:!(),valueAxes:!((id:ValueAxis-1,labels:(filter:!f,rotate:0,show:!t,truncate:100),name:LeftAxis-1,position:left,scale:(mode:normal,type:linear),show:!t,style:(),title:(text:''),type:value))),title:'New+Visualization+init+vs.+all',type:line))" height="600" width="800"></iframe>

And the dashboard sharing works in a similar way. The Share saved dashboard Embedded iframe URL uses the guid of the saved dashboard and changes to that dashboard (like adding or removing a visualization) would be reflected in the embedded iframe.

And the Share Snapshot Embedded iframe contains the explicit list of visualizations and so it would not change if I changed the saved dashboard. But this is including the Saved Visualizations, not the Snapshot Visualizations.
If it contained all of the Snapshot Visualizations then it would have your "foobar" user link in each visualization. But it would also get extremely long and I'm not sure what length limits it would hit. Certainly it would be a problem on Internet Explorer.

In summary, I think you can embed the Snapshot iframe from each visualization and have your proxy change the user in each of them. But neither the Saved or Snapshot Dashboard iframe will contain that user string.

Hi LeeDr,

Thanks for explaining.
Three points :

  • URL size : You're right, but it's a new problem :slight_smile: - And in fact we don't really care about this (in our case), cause our user reach a simple URL ( then the nodejs proxy is responsible to build the URL for Kibana (around 1500 char) and then forward the repsponse to the browser
  • Visualization "share" offer this kind of feature => Very strange to say " neither the Saved or Snapshot Dashboard iframe will contain that user string"
  • I add 5 lines of code in the panel.js and it work like a charm - I'll write the Unit test and then PR

Kibana is a very nice tool - thanks - but to be honnest for most of the use cases Companies will need to add some "user business rule". I'm totally agree that's not the job of Kibana to integrate all the rules of the world, so let the doors open to control the workflow would be good !

We give the PR URL later if any user like me is interested :wink:


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