URL drilldownedit

This functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.

The URL drilldown allows you to navigate from a dashboard to an internal or external URL. The destination URL can be dynamic, depending on the dashboard context or user’s interaction with a visualization.

For example, you might have a dashboard that shows data from a Github repository. You can create a drilldown that navigates from this dashboard to Github.

Drilldown on pie chart that navigates to Github

URL drilldown is available with the Gold subscription and higher.

Supported panelsedit

The following panels support URL drilldowns:

  • Lens
  • Area
  • Data table
  • Heat map
  • Horizontal bar
  • Line
  • Pie
  • Tag cloud
  • Vertical bar

Try it: Create a URL drilldownedit

This example shows how to create the "Show on Github" drilldown shown above.

  1. Add the sample web logs data set.
  2. Open the [Logs] Web traffic dashboard. This isn’t data from Github, but it should work for demonstration purposes.
  3. In the dashboard menu bar, click Edit.
  4. In [Logs] Visitors by OS, open the panel menu, and then select Create drilldown.
  5. Give the drilldown a name: Show on Github.
  6. Select a drilldown action: Go to URL.

    Action picker

  7. Enter a URL template:

    https://github.com/elastic/kibana/issues?q=is:issue+is:open+{{event.value}}

    This example URL navigates to Kibana issues on Github. {{event.value}} will be substituted with a value associated with a clicked pie slice. In preview {{event.value}} is substituted with a dummy value.

    URL template input

  8. Click Create drilldown.
  9. Save the dashboard.

    If you don’t save the drilldown, and then navigate away, the drilldown is lost.

  10. In [Logs] Visitors by OS, click any slice of the pie, and then select the drilldown Show on Github.

    URL drilldown popup

    You are navigated to the issue list in the Kibana repository. Verify that value from a pie slice you’ve clicked on is carried over to Github.

    Github

Picking a trigger for a URL drilldownedit

Some panels support multiple user interactions (called triggers) for which you can configure a URL drilldown. The list of supported variables in the URL template depends on the trigger you selected. In the preceding example, you configured a URL drilldown on a pie chart. The only trigger that pie chart supports is clicking on a pie slice, so you didn’t have to pick a trigger.

However, the sample [Logs] Unique Visitors vs. Average Bytes chart supports both clicking on a data point and selecting a range. When you create a URL drilldown for this chart, you have the following choices:

Trigger picker: Single click and Range selection

Variables in the URL template differ per trigger. For example, Single click has {{event.value}} and Range selection has {{event.from}} and {{event.to}}. You can create multiple URL drilldowns per panel and attach them to different triggers.

URL templating languageedit

The URL template input uses Handlebars — a simple templating language. Handlebars templates look like regular text with embedded Handlebars expressions.

https://github.com/elastic/kibana/issues?q={{event.value}}

A Handlebars expression is a {{, some contents, followed by a }}. When the drilldown is executed, these expressions are replaced by values from the dashboard and interaction context.

Refer to Handlebars documentation to learn about advanced use cases.

In addition to built-in Handlebars helpers, you can use the following custom helpers:

Helper Use case

json

Serialize variables in JSON format.

Example:

{{json event}}
{{json event.key event.value}}
{{json filters=context.panel.filters}}

rison

Serialize variables in rison format. Rison is a common format for Kibana apps for storing state in the URL.

Example:

{{rison event}}
{{rison event.key event.value}}
{{rison filters=context.panel.filters}}

date

Format dates. Supports relative dates expressions (for example, "now-15d"). Refer to the moment docs for different formatting options.

Example:

{{ date event.from “YYYY MM DD”}}
{{date “now-15”}}

formatNumber

Format numbers. Numbers can be formatted to look like currency, percentages, times or numbers with decimal places, thousands, and abbreviations. Refer to the numeral.js for different formatting options.

Example:

{{formatNumber event.value "0.0"}}

lowercase

Converts a string to lower case.

Example:

{{lowercase event.value}}

uppercase

Converts a string to upper case.

Example:

{{uppercase event.value}}

trim

Removes leading and trailing spaces from a string.

Example:

{{trim event.value}}

trimLeft

Removes leading spaces from a string.

Example:

{{trimLeft event.value}}

trimRight

Removes trailing spaces from a string.

Example:

{{trimRight event.value}}

mid

Extracts a substring from a string by start position and number of characters to extract.

Example:

{{mid event.value 3 5}} - extracts five characters starting from a third character.

left

Extracts a number of characters from a string (starting from left).

Example:

{{left event.value 3}}

right

Extracts a number of characters from a string (starting from right).

Example:

{{right event.value 3}}

concat

Concatenates two or more strings.

Example:

{{concat event.value "," event.key}}

replace

Replaces all substrings within a string.

Example:

{{replace event.value "stringToReplace" "stringToReplaceWith"}}

split

Splits a string using a provided splitter.

Example:

{{split event.value ","}}

URL template variablesedit

The URL drilldown template has three sources for variables:

  • Global static variables that don’t change depending on the place where the URL drilldown is used or which user interaction executed the drilldown. For example: {{kibanaUrl}}.
  • Context variables that change depending on where the drilldown is created and used. These variables are extracted from a context of a panel on a dashboard. For example, {{context.panel.filters}} gives access to filters that applied to the current panel.
  • Event variables that depend on the trigger context. These variables are dynamically extracted from the interaction context when the drilldown is executed.

A subtle but important difference between context and event variables is that context variables use real values in previews when creating a URL drilldown. For example, {{context.panel.filters}} are previewed with the current filters that applied to a panel. Event variables are extracted during drilldown execution from a user interaction with a panel (for example, from a pie slice that the user clicked on).

Because there is no user interaction with a panel in preview, there is no interaction context to use in a preview. To work around this, Kibana provides a sample interaction that relies on a picked trigger. So in a preview, you might notice that {{event.value}} is replaced with {{event.value}} instead of with a sample from your data. Such previews can help you make sure that the structure of your URL template is valid. However, to ensure that the configured URL drilldown works as expected with your data, you have to save the dashboard and test in the panel.

You can access the full list of variables available for the current panel and selected trigger by clicking Add variable in the top-right corner of a URL template input.

Variables referenceedit

Source Variable Description

Global

kibanaUrl

Kibana base URL. Useful for creating URL drilldowns that navigate within Kibana.

Context

context.panel

Context provided by current dashboard panel.

context.panel.id

ID of a panel.

context.panel.title

Title of a panel.

context.panel.filters

List of Kibana filters applied to a panel.
Tip: Use in combination with rison helper for internal Kibana navigations with carrying over current filters.

context.panel.query.query

Current query string.

context.panel.query.lang

Current query language.

context.panel.timeRange.from
context.panel.timeRange.to

Current time picker values.
Tip: Use in combination with date helper to format date.

context.panel.timeRange.indexPatternId
context.panel.timeRange.indexPatternIds

Index pattern ids used by a panel.

context.panel.savedObjectId

ID of saved object behind a panel.

Single click

event.value

Value behind clicked data point.

event.key

Field name behind clicked data point

event.negate

Boolean, indicating whether clicked data point resulted in negative filter.

event.points

Some visualizations have clickable points that emit more than one data point. Use list of data points in case a single value is insufficient.

Example:

{{json event.points}}
{{event.points.[0].key}}
{{event.points.[0].value}} {{#each event.points}}key=value&{{/each}}

Note:

{{event.value}} is a shorthand for {{event.points.[0].value}}
{{event.key}} is a shorthand for {{event.points.[0].key}}

Range selection

event.from
event.to

from and to values of selected range. Depending on your data, could be either a date or number.
Tip: Consider using date helper for date formatting.

event.key

Aggregation field behind the selected range, if available.

Disable URL drilldownedit

You can disable URL drilldown feature on your Kibana instance by disabling the plugin:

url_drilldown.enabled: false