Search code examples
elasticsearchkibanaelastic-stack

Extend Options list in Kibana to show only special values


I have created a dashboard in Kibana ElasticSearch. In the dashboard, I have added a filter that will only show me certain devices with serial number XY. This also works perfectly so far.

For example, the filter looks like this:

sn.number is one of 00001, 00002, 00003.

Now I have a filter selection which filters by country, model, name etc..

Additionally there is a section: Serial number

But when I open the dropdown bar it shows me all serial numbers, i.e.

> 00001
> 00002
> 00003
> 00004
> 00005

I only want to reduce the selection to my 3 devices (00001, 00002, 00003).

When I want to edit the visualization, I cannot find a way to do this.

Options list in Kibana

Can someone help me further or give some advice?


Solution

  • Legacy Controls do not support pre-filtering filter values.

    The workarounds are:

    1. Create a parent filter that will filter serial numbers to the ones you need.
    2. Create a filtered alias that contains those serial numbers:

    https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html

    POST _aliases
    {
       "actions":[
          {
             "add":{
                "index":"original-index",
                "alias":"filtered-for-controller-index",
                "filter":{
                   "term":{
                      "some_field":"some_value"
                   }
                }
             }
          }
       ]
    }
    

    There is a new project around controls and this feature is in the Roadmap:

    https://github.com/elastic/kibana/issues/140112