The label of kibanaAddFilter doesn't work

Hi,

I am using Vega to create an age pyramid and I would like to filter the data by clicking on a bar. Thus, I created a signal and used kibanaAddFilter to define the query, as shown in the code below.

"signals": [
  {
    "name": "select",
    "on":[
      {
        "events":[{"type": "click", "marktype": "rect"}],
        "update": '''
          kibanaAddFilter({
            "range": {
              "age": {
                 "gte": datum.key,
                 "lt": (datum.key+5)
              }
            }
          },'index-*','age')
          '''
      }
    ]
  }
]

In this case, the alias of the expression function kibanaAddFilter(query, index, alias) was set to 'age', but when I apply the filter, the query appears in the filter bar (image below) instead of the alias (filter label). Am I using this wrongly? How should this parameter be used?

image

Thank you (:

I just tested using an alias and it didn't work either. I've never seen that as an option before. If you've seen it somewhere please let me know.

In the docs it doesn't include an alias, just the index name.

kibanaRemoveFilter(query, index)

The implementation does include alias parameter. After a quick code scan, I could not find any reason why its not working.

Can you open an issue for this please?

It would be really helpful if your steps for showing the bug included sample data sets that ship with Kibana.

2 Likes

I will open an issue now. Thanks!

I upgraded the deployment from v7.13.4 to v8.1.2 and now the filter appears as shown in the image below. It is not yet the defined label in the alias, but it is friendlier than before.

image

Hello @Nathan_Reese I'm using Kibana 8.1.3 and Label is not showing, is this supporting only some query syntax? I'm on cloud, this is the query block:

    {
      "events": {"source": "scope", "type": "click", "markname": "point"},
      "update": '''kibanaAddFilter({"bool": {"filter": {"term": {"manufacturer.keyword": "Oceanavigations"}}}}, 'kibana_sample_data_ecommerce', 'currency')'''
    }

In my case the label is not working either. What I managed to do is make the filter more "friendly", I think if you change it to {"match_phrase": {"manufacturer.keyword": "Oceanavigations"}}, in the filter bar it will look like manufacturer.keyword: Oceanaviations.

A tip is to click on the +Add filter in the filter bar, apply the filter you want and save it. Then you click to edit it and select the option "Edit as Query DSL", that way you will have the query to make the filter more "friendly".

1 Like

I will try that. Thank you @karlanakamura