# The label of kibanaAddFilter doesn't work

**URL:** <https://discuss.elastic.co/t/the-label-of-kibanaaddfilter-doesnt-work/301795>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [April 6, 2022, 7:02pm UTC](https://discuss.elastic.co/t/the-label-of-kibanaaddfilter-doesnt-work/301795 "2022-04-06T19:02:56Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![karlanakamura](https://avatars.discourse-cdn.com/v4/letter/k/bc79bd/32.png) [@karlanakamura](https://discuss.elastic.co/u/karlanakamura)\
**Post date:** [April 6, 2022, 7:02pm UTC](https://discuss.elastic.co/t/the-label-of-kibanaaddfilter-doesnt-work/301795/1 "2022-04-06T19:02:56Z")

</div>

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.

```auto
"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](https://us1.discourse-cdn.com/elastic/original/3X/f/9/f90341ad3516e6e54a7ad535e61899f9d1d440a2.png)

Thank you (:

---

<div class="post-metadata">

**Author:** ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)\
**Post date:** [April 6, 2022, 7:26pm UTC](https://discuss.elastic.co/t/the-label-of-kibanaaddfilter-doesnt-work/301795/2 "2022-04-06T19:26:49Z")

</div>

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](https://www.elastic.co/guide/en/kibana/current/vega.html#vega-expression-functions) it doesn't include an alias, just the index name.

```auto
kibanaRemoveFilter(query, index)

```

---

<div class="post-metadata">

**Author:** ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)\
**Post date:** [April 6, 2022, 7:33pm UTC](https://discuss.elastic.co/t/the-label-of-kibanaaddfilter-doesnt-work/301795/3 "2022-04-06T19:33:03Z")

</div>

The [implementation](https://github.com/elastic/kibana/blob/main/src/plugins/vis_types/vega/public/vega_view/vega_base_view.js#L350) does include `alias` parameter. After a quick code scan, I could not find any reason why its not working.

Can you [open an issue](https://github.com/elastic/kibana/issues/new?assignees=&labels=bug&template=Bug_report.md) for this please?

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

---

<div class="post-metadata">

**Author:** ![karlanakamura](https://avatars.discourse-cdn.com/v4/letter/k/bc79bd/32.png) [@karlanakamura](https://discuss.elastic.co/u/karlanakamura)\
**Post date:** [April 6, 2022, 8:07pm UTC](https://discuss.elastic.co/t/the-label-of-kibanaaddfilter-doesnt-work/301795/4 "2022-04-06T20:07:40Z")

</div>

I will open an issue now. Thanks!

---

<div class="post-metadata">

**Author:** ![karlanakamura](https://avatars.discourse-cdn.com/v4/letter/k/bc79bd/32.png) [@karlanakamura](https://discuss.elastic.co/u/karlanakamura)\
**Post date:** [April 6, 2022, 10:05pm UTC](https://discuss.elastic.co/t/the-label-of-kibanaaddfilter-doesnt-work/301795/5 "2022-04-06T22:05:21Z")

</div>

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](https://us1.discourse-cdn.com/elastic/original/3X/6/4/647f259707c0fba16d2df098af47ebc3d9d52aab.png)

---

<div class="post-metadata">

**Author:** ![Gustavo\_Llermaly](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gustavo_llermaly/32/92019_2.png) [@Gustavo\_Llermaly](https://discuss.elastic.co/u/Gustavo_Llermaly)\
**Post date:** [April 29, 2022, 6:18pm UTC](https://discuss.elastic.co/t/the-label-of-kibanaaddfilter-doesnt-work/301795/6 "2022-04-29T18:18:26Z")

</div>

> [@karlanakamura](#):
>
> ```auto
> {
> "range": {
> "age": {
> "gte": datum.key,
> "lt": (datum.key+5)
> }
> }
> 
> ```

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')'''
    }

```

---

<div class="post-metadata">

**Author:** ![karlanakamura](https://avatars.discourse-cdn.com/v4/letter/k/bc79bd/32.png) [@karlanakamura](https://discuss.elastic.co/u/karlanakamura)\
**Post date:** [May 2, 2022, 12:49pm UTC](https://discuss.elastic.co/t/the-label-of-kibanaaddfilter-doesnt-work/301795/7 "2022-05-02T12:49:02Z")

</div>

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".

---

<div class="post-metadata">

**Author:** ![Gustavo\_Llermaly](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gustavo_llermaly/32/92019_2.png) [@Gustavo\_Llermaly](https://discuss.elastic.co/u/Gustavo_Llermaly)\
**Post date:** [May 2, 2022, 1:50pm UTC](https://discuss.elastic.co/t/the-label-of-kibanaaddfilter-doesnt-work/301795/8 "2022-05-02T13:50:37Z")

</div>

I will try that. Thank you @karlanakamura

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 30, 2022, 1:51pm UTC](https://discuss.elastic.co/t/the-label-of-kibanaaddfilter-doesnt-work/301795/9 "2022-05-30T13:51:07Z")

</div>

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