# Field.keyword is empty, yet something is shown under field

**URL:** <https://discuss.elastic.co/t/field-keyword-is-empty-yet-something-is-shown-under-field/174113>\
**Category:** Kibana\
**Created:** [March 27, 2019, 11:48am UTC](https://discuss.elastic.co/t/field-keyword-is-empty-yet-something-is-shown-under-field/174113 "2019-03-27T11:48:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ebisu](https://avatars.discourse-cdn.com/v4/letter/e/3ab097/32.png) [@Ebisu](https://discuss.elastic.co/u/Ebisu)\
**Post date:** [March 27, 2019, 11:48am UTC](https://discuss.elastic.co/t/field-keyword-is-empty-yet-something-is-shown-under-field/174113/1 "2019-03-27T11:48:06Z")

</div>

My field `msg` is a result of using grok with `%{GREEDYDATA}`. If I apply the following filter in Kibana's "Disover": `NOT msg.keyword: "exists"`, roughly half of all events match. But for those `msg` is not empty. Can somebody explain to me what is going on here?

---

<div class="post-metadata">

**Author:** ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)\
**Post date:** [March 27, 2019, 4:18pm UTC](https://discuss.elastic.co/t/field-keyword-is-empty-yet-something-is-shown-under-field/174113/2 "2019-03-27T16:18:13Z")

</div>

Hey @Ebisu, when using the query `NOT msg.keyword: "exists"` it will return all documents which don't have the string "exists" for the `msg.keyword` field.

To better explain this behavior, if you insert the following 3 documents into ES using Dev Tools:

```auto
POST ebisu/_doc
{
  "msg": "exists"
}

POST ebisu/_doc
{
  "msg": "foo"
}

POST ebisu/_doc
{
  "msg": "bar"
}

```

If we use the aforementioned filter in the query bar, we'll see both "foo" and "bar" returned, as they don't have a `msg.keyword` field of "exists":

 ![55%20AM](https://us1.discourse-cdn.com/elastic/original/3X/6/9/696d7d44de583257a62155358c139fd0987558c0.png)

---

<div class="post-metadata">

**Author:** ![Ebisu](https://avatars.discourse-cdn.com/v4/letter/e/3ab097/32.png) [@Ebisu](https://discuss.elastic.co/u/Ebisu)\
**Post date:** [March 28, 2019, 8:17am UTC](https://discuss.elastic.co/t/field-keyword-is-empty-yet-something-is-shown-under-field/174113/3 "2019-03-28T08:17:18Z")

</div>

Thanks for your answer.

If I paste `NOT msg.keyword: "exists"` in the filter field and click refresh, I get a different number of matches than if I click on "Add filter", select `msg.keyword`, select "does not exist" and click on "save".

---

<div class="post-metadata">

**Author:** ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)\
**Post date:** [March 28, 2019, 1:38pm UTC](https://discuss.elastic.co/t/field-keyword-is-empty-yet-something-is-shown-under-field/174113/4 "2019-03-28T13:38:59Z")

</div>

@Ebisu, that is to be expected. The query-bar and filter-bar use different syntax per [https://www.elastic.co/guide/en/kibana/current/search.html](https://www.elastic.co/guide/en/kibana/current/search.html)

---

<div class="post-metadata">

**Author:** ![Ebisu](https://avatars.discourse-cdn.com/v4/letter/e/3ab097/32.png) [@Ebisu](https://discuss.elastic.co/u/Ebisu)\
**Post date:** [March 29, 2019, 1:59pm UTC](https://discuss.elastic.co/t/field-keyword-is-empty-yet-something-is-shown-under-field/174113/5 "2019-03-29T13:59:48Z")

</div>

Yes, I meant the query-bar syntax, sorry! How is it possible that Kibana claims field.keyword doesn't exist, while field is not empty?

If I make a pie chart Count / Term\>field.keyword and include missing values, I get a huge slice for "missing".

---

<div class="post-metadata">

**Author:** ![Ebisu](https://avatars.discourse-cdn.com/v4/letter/e/3ab097/32.png) [@Ebisu](https://discuss.elastic.co/u/Ebisu)\
**Post date:** [April 1, 2019, 6:30pm UTC](https://discuss.elastic.co/t/field-keyword-is-empty-yet-something-is-shown-under-field/174113/6 "2019-04-01T18:30:09Z")

</div>

I found the reason: some entries were too long and Elasticsearch choose “text” instead of “keyword”. Sorry, I'm new to this – it wasn't really a Kibana question.

---

<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:** [April 29, 2019, 6:30pm UTC](https://discuss.elastic.co/t/field-keyword-is-empty-yet-something-is-shown-under-field/174113/7 "2019-04-29T18:30:12Z")

</div>

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