# Search for a non empty field

**URL:** https://discuss.elastic.co/t/search-for-a-non-empty-field/107736
**Category:** Kibana
**Created:** [November 15, 2017, 11:55am UTC](https://discuss.elastic.co/t/search-for-a-non-empty-field/107736 "2017-11-15T11:55:11Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![fernandoblalves](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fernandoblalves/32/24268_2.png) [@fernandoblalves](https://discuss.elastic.co/u/fernandoblalves)
#### Post date: [November 15, 2017, 11:55am UTC](https://discuss.elastic.co/t/search-for-a-non-empty-field/107736/1 "2017-11-15T11:55:11Z")

</div>

Hi,

For each event I collect on logstash, I add a field called "tags" that always exists, and contains an array that may be empty.  
On kibana, I want to search for events that do not contain an empty array. I tried with

```
_exists_:tags

```

but the results do not seem correct. Can someone please tell me how to search for empty and for non empty fields, for null and non null fields, depending on the field type (e.g., string, array)? I searched the documentation but did not find a direct answer.

Thanks

---

<div class="post-metadata">

### Author: ![Bargs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bargs/32/5429_2.png) [@Bargs](https://discuss.elastic.co/u/Bargs)
#### Post date: [November 15, 2017, 9:22pm UTC](https://discuss.elastic.co/t/search-for-a-non-empty-field/107736/2 "2017-11-15T21:22:33Z")

</div>

How is your `tags` field mapped? Documents where `tags = []` should not match that query.

[https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html)

---

<div class="post-metadata">

### Author: ![fernandoblalves](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fernandoblalves/32/24268_2.png) [@fernandoblalves](https://discuss.elastic.co/u/fernandoblalves)
#### Post date: [November 16, 2017, 3:23pm UTC](https://discuss.elastic.co/t/search-for-a-non-empty-field/107736/3 "2017-11-16T15:23:08Z")

</div>

I must have had some errors somewhere, I checked and using on kibana `_exists_:tags` and `!_exists_:tags` provides the correct results, even though the `tags` field is never null.

Thanks

---

<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: [December 14, 2017, 3:23pm UTC](https://discuss.elastic.co/t/search-for-a-non-empty-field/107736/4 "2017-12-14T15:23:12Z")

</div>

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