# How do I pass the value of my field in a dashboard's filter?

**URL:** https://discuss.elastic.co/t/how-do-i-pass-the-value-of-my-field-in-a-dashboards-filter/179737
**Category:** Kibana
**Created:** [May 6, 2019, 9:43am UTC](https://discuss.elastic.co/t/how-do-i-pass-the-value-of-my-field-in-a-dashboards-filter/179737 "2019-05-06T09:43:10Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![lobotomeh](https://avatars.discourse-cdn.com/v4/letter/l/96bed5/32.png) [@lobotomeh](https://discuss.elastic.co/u/lobotomeh)
#### Post date: [May 6, 2019, 9:43am UTC](https://discuss.elastic.co/t/how-do-i-pass-the-value-of-my-field-in-a-dashboards-filter/179737/1 "2019-05-06T09:43:10Z")

</div>

Hello everyone,  
I'm struggling with this and I know this is possible (as I have seen someone doing it), but somehow I can't make it work for me :

I have a dashboard, which display the result of a Saved Search (saved from the discovery part).  
I would like my user to be able to trigger a filter when they click on the value of one of the displayed field (which is a keyword text field). They click, it opens a new tab with the same dashboard, and the value they clicked on is passed as a value for a filter

_ **What I've tried so far :** _  
I have my dashboard, with some pinned filters, and a filter on the scripted field "Suivre Application".  
I have made a Scripted field. Type String and link, format Url. The url template is like this (sorry, it's very long, as I have other pinned filters, i have highlitghted the important part) :

#/dashboard/b52c9b50-6807-11e9-a76c-57b197a9da76?\_g=(refreshInterval:(pause:!t,value:0),time:(from:now-90d,mode:quick,to:now))&\_a=(description:'',filters:!(('$state':(store:appState), meta:(alias:DEBUG,disabled:!t,index:f22f8760-65c3-11e9-a76c-57b197a9da76, key:severity,negate:!t,params:(query:DEBUG,type:phrase), type:phrase,value:DEBUG),query:(match:(severity:(query:DEBUG, type:phrase)))),('$state':(store:appState),meta:(alias:ERROR, disabled:!t,index:f22f8760-65c3-11e9-a76c-57b197a9da76,key:severity,negate:!t,params:(query:ERROR, type:phrase),type:phrase,value:ERROR),query:(match:(severity:(query:ERROR, type:phrase)))),('$state':(store:appState),meta:(alias:WARN,disabled:!t, index:f22f8760-65c3-11e9-a76c-57b197a9da76,key:severity,negate:!t,params:(query:WARN, type:phrase),type:phrase,value:WARN),query:(match:(severity:(query:WARN,type:phrase)))), ('$state':(store:appState),meta:(alias:TRACE,disabled:!t,index:f22f8760-65c3-11e9-a76c-57b197a9da76, key:severity,negate:!t,params:(query:TRACE,type:phrase),type:phrase,value:TRACE), query:(match:(severity:(query:TRACE,type:phrase)))),('$state':(store:appState), meta:(alias:INFO,disabled:!t,index:f22f8760-65c3-11e9-a76c-57b197a9da76, key:severity,negate:!t,params:(query:INFO,type:phrase),type:phrase,value:INFO), query:(match:(severity:(query:INFO,type:phrase)))),('$state':(store:appState), meta:(alias:!n,disabled:!f,index:f22f8760-65c3-11e9-a76c-57b197a9da76, **key:'Suivre+Application',negate:!f,params:(query:{{value}}**,type:phrase), type:phrase, **value:{{value}}** ),**query:(match:('Suivre+Application':(query:{{value}}**,type:phrase))))), fullScreenMode:!f,options:(darkTheme:!f,hidePanelTitles:!f,useMargins:!t), query:(language:lucene,query:''), timeRestore:!f, title:'Dashboard+Logs+Applicatifs\_essai\_liens', viewMode:view)

The link works, it opens a new tab with the corresponding dashboard, but the value of the filter "Suivre Application" doesn't change. It always have the value with which i've created it.

Then I tried to modify the field "applicative\_code" from which this scripted field got his value.  
I changed it to Format : Url and Type: Link. In the URL template, i've pasted the url of my dashboard, and modified the value of the filter with {{value}} :

[http://mydomain.com/app/kibana#/dashboard/b52c9b50-6807-11e9-a76c-57b197a9da76?\_g=(refreshInterval:(display:Off,pause:!t,value:0),time:(from:now-90d,mode:quick,to:now)](http://mydomain.com/app/kibana#/dashboard/b52c9b50-6807-11e9-a76c-57b197a9da76?_g=(refreshInterval:(display:Off,pause:!t,value:0),time:(from:now-90d,mode:quick,to:now)))&\_a=(description:'',filters:!(('$state':(store:appState),meta:(alias:DEBUG,disabled:!t,index:f22f8760-65c3-11e9-a76c-57b197a9da76,key:severity,negate:!t,params:(query:DEBUG,type:phrase),type:phrase,value:DEBUG),query:(match:(severity:(query:DEBUG,type:phrase)))),('$state':(store:appState),meta:(alias:ERROR,disabled:!t,index:f22f8760-65c3-11e9-a76c-57b197a9da76,key:severity,negate:!t,params:(query:ERROR,type:phrase),type:phrase,value:ERROR),query:(match:(severity:(query:ERROR,type:phrase)))),('$state':(store:appState),meta:(alias:WARN,disabled:!t,index:f22f8760-65c3-11e9-a76c-57b197a9da76,key:severity,negate:!t,params:(query:WARN,type:phrase),type:phrase,value:WARN),query:(match:(severity:(query:WARN,type:phrase)))),('$state':(store:appState),meta:(alias:TRACE,disabled:!t,index:f22f8760-65c3-11e9-a76c-57b197a9da76,key:severity,negate:!t,params:(query:TRACE,type:phrase),type:phrase,value:TRACE),query:(match:(severity:(query:TRACE,type:phrase)))),('$state':(store:appState),meta:(alias:INFO,disabled:!t,index:f22f8760-65c3-11e9-a76c-57b197a9da76,key:severity,negate:!t,params:(query:INFO,type:phrase),type:phrase,value:INFO),query:(match:(severity:(query:INFO,type:phrase)))),('$state':(store:appState),meta:(alias:!n,disabled:!t,field: **applicative\_code.keyword** ,index:f22f8760-65c3-11e9-a76c-57b197a9da76, **key:applicative\_code.keyword** ,negate:!f,**params:(value:{{value}}),type:phrase,value:{{value}}**),script:(script:(inline:'boolean+compare(Supplier+s,+def+v)+%7Breturn+s.get()+%3D%3D+v;%7Dcompare(()+-%3E+%7B+doc%5B!'applicative\_code.keyword!'%5D.value+%7D,+params.value);',lang:painless,params:(value:{{value}}))))),fullScreenMode:!f,options:(darkTheme:!f,hidePanelTitles:!f,useMargins:!t),panels:!((gridData:(h:3,i:'1',w:12,x:0,y:0),id:'83289b70-65c5-11e9-a76c-57b197a9da76',panelIndex:'1',type:visualization,version:'6.2.2'),(gridData:(h:4,i:'2',w:12,x:0,y:3),id:'4db67120-6808-11e9-a76c-57b197a9da76',panelIndex:'2',sort:!('Suivre+Application',desc),type:search,version:'6.2.2')),query:(language:lucene,query:''),timeRestore:!t,title:'Dashboard+Logs+Applicatifs\_essai\_liens',viewMode:view)

Same problem as before, it opens the right dashboard, but it doesn't apply the right value for the filter.

I think my explanation might be complex. Don't hesitate to ask me to edit. Thank you all !

---

<div class="post-metadata">

### Author: ![thomasneirynck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomasneirynck/32/23313_2.png) [@thomasneirynck](https://discuss.elastic.co/u/thomasneirynck)
#### Post date: [May 8, 2019, 1:43pm UTC](https://discuss.elastic.co/t/how-do-i-pass-the-value-of-my-field-in-a-dashboards-filter/179737/2 "2019-05-08T13:43:55Z")

</div>

@lobotomeh,

your approach looks about right. Hacking the URL is really fickle. That part of the query-string is RISON encoded, so you must make sure that the {{value}} that gets plugged in creates a valid string. (e.g. if you have spaces in your value, they must be escaped with `%20`

When you click the link, what is the URL that is produced (so after substitution of {{value}}? Is that a valid URL and is the value plugged in correctly?

---

<div class="post-metadata">

### Author: ![lobotomeh](https://avatars.discourse-cdn.com/v4/letter/l/96bed5/32.png) [@lobotomeh](https://discuss.elastic.co/u/lobotomeh)
#### Post date: [May 9, 2019, 1:42pm UTC](https://discuss.elastic.co/t/how-do-i-pass-the-value-of-my-field-in-a-dashboards-filter/179737/3 "2019-05-09T13:42:35Z")

</div>

Hello Thomas, thank you for your reply !

So my original {{value}} looks like this :  
AFA@1221@1062-MY\_APPLICATION\_1@1.0.0.SIG

And the value I can find in the URL looks like this :  
AFA%401221%401062-MY\_APPLICATION\_1%401.0.0.SIG

So I guess here there is a problem with the encoding ? is the "@" character allowed ?  
I couldn't find any useful ressource about Rison encoding, do you know one ?

EDIT :  
I've tried with a url with a simple string : "hello". It works like this. So I guess the special characters are messing with the url.

As a work around, i've tried passing the {{value}} in a lucene query instead. So it looks like this in the url :

[http://myurl.com/with\_a\_lot\_of\_parameters](http://myurl.com/with_a_lot_of_parameters),  
**query:(language:lucene,query:{{value}})**,timeRestore:!t,title:'Dashboard',viewMode:view)

But it doesn't work either.  
Any idea of a work around ?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [June 6, 2019, 1:42pm UTC](https://discuss.elastic.co/t/how-do-i-pass-the-value-of-my-field-in-a-dashboards-filter/179737/4 "2019-06-06T13:42:43Z")

</div>

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