Generating a url that contains a query


(Dafna Frank) #1

Hi, I would like to automatically create a url and pass to my users so they could see the results of the query from Kibana.

The query needs to contains something similar to this:
{
"query": {
"match": {
"kubernetes.pod_name.keyword": {
"query": "my_pod_name",
"type": "phrase"
}
}
}
}

"my_pod_name" is dynamically created.

I've tried to create a filter but the url looks nothing like the query and contains guids and auto generated values which I do not understand how I can get them.

Is it a simple get command or should it be a post command?

How to I crate and pass such url to users?
Thanks


(Tyler Smalley) #2

Unfortunately, there isn't a great to accomplish this now as our URL's are RISON encoded, which is not friendly. There is work being done that will improve this in the future, though.

You're best bet is to create a filter on Discover which includes the Pod Name, and replace that value with your dynamic one.

For example: http://localhost:5601/app/kibana#/discover?_g=(refreshInterval:(pause:!t,value:0),time:(from:now-7d,mode:quick,to:now))&_a=(columns:!(_source),filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:d3d7af60-4c81-11e8-b3d7-01146121b73d,key:Carrier,negate:!f,params:(query:JetBeats,type:phrase),type:phrase,value:JetBeats),query:(match:(Carrier:(query:JetBeats,type:phrase))))),index:d3d7af60-4c81-11e8-b3d7-01146121b73d,interval:auto,query:(language:lucene,query:''),sort:!(timestamp,desc))

This is a filter on Carrier: JetBeats. If I want to create a URL to show me results of a specific carrier, I would just need to make that value dynamic.


(Dafna Frank) #3

Thank you.
I;ve created a filter. How do I share this url now (so that I could make changes to the pod_name?


(Tyler Smalley) #4

Click the share button at the top of Discover.


(Dafna Frank) #5

I've created such filter, shared it. Copied the link from the saved dashboard then changed the name of the pod to a different one (3 places).
Copied the link and paste it to a browser.
What I got is a kibana page with the two different pods as a filter... which is not what I wanted...

Am I doing something wrong?
Here is the link:
http://kibana-eslogs.outbrain.com:5601/app/kibana#/dashboard/4e3ebc20-f787-11e8-87fb-47a8ed084b01?_g=(filters%3A!(('%24state'%3A(store%3AglobalState)%2Cexists%3A(field%3Aexception.keyword)%2Cmeta%3A(alias%3AExceptions%2Cdisabled%3A!t%2Cindex%3A'8fafd360-910c-11e8-ae83-59ddfdbdb492'%2Ckey%3Aexception.keyword%2Cnegate%3A!f%2Ctype%3Aexists%2Cvalue%3Aexists))%2C('%24state'%3A(store%3AglobalState)%2Cmeta%3A(alias%3A!n%2Cdisabled%3A!f%2Cindex%3A'8fafd360-910c-11e8-ae83-59ddfdbdb492'%2Ckey%3Akubernetes.pod_name.keyword%2Cnegate%3A!f%2Cparams%3A(query%3Aservice-prod-shaharf-sa-86458858b7-579sd%2Ctype%3Aphrase)%2Ctype%3Aphrase%2Cvalue%3Aservice-prod-shaharf-sa-86458858b7-579sd)%2Cquery%3A(match%3A(kubernetes.pod_name.keyword%3A(query%3Aservice-prod-shaharf-sa-86458858b7-579sd%2Ctype%3Aphrase)))))%2CrefreshInterval%3A(display%3AOff%2Cpause%3A!f%2Cvalue%3A0)%2Ctime%3A(from%3Anow-1h%2Cmode%3Aquick%2Cto%3Anow))