# Kibana filter incorrectly applied

**URL:** https://discuss.elastic.co/t/kibana-filter-incorrectly-applied/335337
**Category:** Kibana
**Created:** [June 6, 2023, 12:11pm UTC](https://discuss.elastic.co/t/kibana-filter-incorrectly-applied/335337 "2023-06-06T12:11:04Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![willemdh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/willemdh/32/16922_2.png) [@willemdh](https://discuss.elastic.co/u/willemdh)
#### Post date: [June 6, 2023, 12:11pm UTC](https://discuss.elastic.co/t/kibana-filter-incorrectly-applied/335337/1 "2023-06-06T12:11:04Z")

</div>

Hello,

When we select this filter

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/b/eb877f8caa21ac01bea8c312f03a94ac469e69ef.png)

It seems to apply not only to "update", but also for example to "update-security"....

![image](https://us1.discourse-cdn.com/elastic/original/3X/7/0/70c3c31dba4b08c770276747abd7d584ac9648a2.png)

Seems like a bug to me?

Willem

---

<div class="post-metadata">

### Author: ![ppisljar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppisljar/32/11588_2.png) [@ppisljar](https://discuss.elastic.co/u/ppisljar)
#### Post date: [June 7, 2023, 9:34am UTC](https://discuss.elastic.co/t/kibana-filter-incorrectly-applied/335337/2 "2023-06-07T09:34:49Z")

</div>

can you check the dsl that is generated ? (click edit query dsl in the filter)

---

<div class="post-metadata">

### Author: ![willemdh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/willemdh/32/16922_2.png) [@willemdh](https://discuss.elastic.co/u/willemdh)
#### Post date: [June 7, 2023, 10:08am UTC](https://discuss.elastic.co/t/kibana-filter-incorrectly-applied/335337/3 "2023-06-07T10:08:26Z")

</div>

The dsl filter:

```auto
{
  "bool": {
    "minimum_should_match": 1,
    "should": [
      {
        "match_phrase": {
          "infoblox_nios.log.dns.category": "update"
        }
      }
    ]
  }
}

```

---

<div class="post-metadata">

### Author: ![ppisljar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppisljar/32/11588_2.png) [@ppisljar](https://discuss.elastic.co/u/ppisljar)
#### Post date: [June 8, 2023, 9:30am UTC](https://discuss.elastic.co/t/kibana-filter-incorrectly-applied/335337/4 "2023-06-08T09:30:47Z")

</div>

@lukas can you please take a look

---

<div class="post-metadata">

### Author: ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)
#### Post date: [June 12, 2023, 9:30pm UTC](https://discuss.elastic.co/t/kibana-filter-incorrectly-applied/335337/5 "2023-06-12T21:30:49Z")

</div>

Yes, this is expected, since (I'm assuming) `infoblox_nios.log.dns.category` is an analyzed field. If you want an exact match, you'll have to use the `keyword` version of the field.

---

<div class="post-metadata">

### Author: ![willemdh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/willemdh/32/16922_2.png) [@willemdh](https://discuss.elastic.co/u/willemdh)
#### Post date: [July 1, 2023, 8:56pm UTC](https://discuss.elastic.co/t/kibana-filter-incorrectly-applied/335337/6 "2023-07-01T20:56:45Z")

</div>

Honetly I have no clue what you mean this is expected. The filter says "match\_phrase", but it doesn't match at all? The field doesn't has a keyword version fyi.

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [July 2, 2023, 12:53am UTC](https://discuss.elastic.co/t/kibana-filter-incorrectly-applied/335337/7 "2023-07-02T00:53:29Z")

</div>

> [@willemdh](#):
>
> Honetly I have no clue what you mean this is expected. The filter says "match\_phrase", but it doesn't match at all?

This is expected because this field is mapped as a `text` field as you can check [here](https://github.com/elastic/integrations/blob/main/packages/infoblox_nios/data_stream/log/fields/fields.yml).

The field `infoblox_nios.log.dns.category` is mapped as `text` so it will be an analyzed field, in this case your query will match any document that has `updated` on it and not just documents that have only `update` but no `update-security`.

To have an exact match you would need the field to be mapped as `keyword`, you will also not have a `keyword` field because the mapping for it was not created.

It is not a bug, but in my opinion the mapping for this field seems to be wrong, if this represents a category with values like the ones you shared, this should've be mapped as a `keyword` field not a `text` field.

I think you should open an issue in the [integrations repository](https://github.com/elastic/integrations) so Elastic can look at it and change the mapping.

You could also try to use a [runtime field](https://www.elastic.co/guide/en/elasticsearch/reference/current/runtime-mapping-fields.html#runtime-fields-scriptless) to make this field behave like a `keyword` field, but beware that this can have a performance impact.

---

<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: [July 30, 2023, 12:54am UTC](https://discuss.elastic.co/t/kibana-filter-incorrectly-applied/335337/8 "2023-07-30T00:54:20Z")

</div>

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