Create button with filters in dashboards

Hello, I need to create a button on the dashboard to enable a filter based on the value of X. At the same time, when you click it again, the filter is removed. Please tell me how to create this button.

Hello @SYGH,

Welcome to the community!

Which version of Elastic are you using? You can use Kibana Controls and add the filter panel to your dashboard.

I use Elastic Stack v 7.17.9. I known about controls, but I don't want to use them because I don't want to enter a value every time.

In this case you can simply save a filter to your Dashboard.

Click on Add Filter > edit your filter > Save

Note: You can disable and re-enable the saved filter whenever you want, so there's no need to delete it and create a new one each time.

I know about such a feature, but I want to create a button in the dashboard itself for filtering.
image
I was able to write the code for the button, but I don't know how to modify it so that it sets the filter when clicked.

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "title": "Filter by mccmnc",
  "signals": [
    {"name": "filterMCCMNC", "init": null}
  ],
  "data": {"url": {"%context%": true, "index": "edr-*"}},
  "selection": {
    "click": {
      "type": "single",
      "fields": ["mccmnc"],
      "init": {"mccmnc": "XXXXXX"},
      "bind": {
        "input": "checkbox",
        "name": "X",
        "description": "Filter by X",
        "value": "XXXXXX"
      }
    }
  },
  "autosize": "none"
  "width": "2cm",
  "height": "3cm",
  "mark": "rect",
  "encoding": {
    "color": {"value": "lightgray"}
  },
  "transform": [{"filter": {"selection": "click"}}]
}

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