Kibana (Discover) URLs look a bit funky. All the query information is encoded in the URL with a serialization format called RISON. This is a pretty obscure format (it doesn't even have a Wikipedia page at the moment) based on JSON but with some tweaks to make it more URL-compatible and compact.
For example, instead of JSON's structural delimiters {}
and []
, it uses ()
.
Unfortunately, when working in a Markdown context,
the abundance of parentheses in these Kibana URL will easily confuse a Markdown parser
when you try to put such an URL in Markdown's basic link format [title](url)
.
The trick is URL-encoding the offending characters.
However, generically URL-encoding all risky characters also doesn't work well
as Kibana does not seem to decode that properly.
At the moment, what seems to work for me is URL-encoding just (
, )
and $
.
For example with this Python snippet:
url = "https://kibana.test/#/discover?_a=(columns:!(message),filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'907d8590-4f1b-11e..."
print(url.replace("$", "%24").replace("(", "%28").replace(")", "%29"))
Or this CLI one-liner to pipe the URL into
(e.g. execute command, paste URL, press enter twice and close input with CTRL-D
):
python -c 'import sys;print(sys.stdin.read().strip().replace("$","%24").replace("(","%28").replace(")","%29"))'
Or use this minimal webapp
(Old-school vanilla JavaScript applets FTW!)