Is kibana supports dynamic filters to a URL?

Is kibana supports dynamic filters to a URL ?

Example -
create a filter on an index and saved this search.
copy the URL
This search URL is associated to the one of the field in Index Pattern. But, I couldn't add different filter URL on the Same index in Index Pattern.
How can we generate URL with dynamic filters ?

1 Like

Kibana stores the filters in the URL for Discover/Visualize/Dashboard encoded as rison, so you can dynamically generate a URL containing a certain filter. However you have to make sure to generate a valid filter in there. Consider the following case:

filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'90943e30-9a47-11e8-b64d-95841ca0b247',key:extension.keyword,negate:!f,params:(query:gz),type:phrase),query:(match_phrase:(extension.keyword:gz))))

it's equivalent to the following JSON:

{
    "filters": [
        {
            "$state": {
                "store": "appState"
            },
            "meta": {
                "alias": null,
                "disabled": false,
                "index": "90943e30-9a47-11e8-b64d-95841ca0b247",
                "key": "extension.keyword",
                "negate": false,
                "params": {
                    "query": "gz"
                },
                "type": "phrase"
            },
            "query": {
                "match_phrase": {
                    "extension.keyword": "gz"
                }
            }
        }
    ]
}

To change the field and the value it's matching, you have to change it in both the meta.key and meta.params.query property, as well as in the query.match_phrase property.

You can use https://rison.io/ to play around with JSON/RISON to get a feeling for how it works

1 Like

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