# Query on array fields with null value

**URL:** <https://discuss.elastic.co/t/query-on-array-fields-with-null-value/332426>\
**Category:** Elasticsearch\
**Created:** [May 3, 2023, 1:28pm UTC](https://discuss.elastic.co/t/query-on-array-fields-with-null-value/332426 "2023-05-03T13:28:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhggw](https://avatars.discourse-cdn.com/v4/letter/d/f05b48/32.png) [@dhggw](https://discuss.elastic.co/u/dhggw)\
**Post date:** [May 3, 2023, 1:28pm UTC](https://discuss.elastic.co/t/query-on-array-fields-with-null-value/332426/1 "2023-05-03T13:28:57Z")

</div>

Hello all,

we have in our index fields with arrays, each containing only one element, which is NULL:

```auto
"field": [
    null
]

```

I would like to filter on just these records, however I can't find a query that will do this. ELS somehow does not like 'null' in this constellation.

Can anyone help?

Many thanks and greetings  
Daniel

---

<div class="post-metadata">

**Author:** ![Lisa\_Jung](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lisa_jung/32/90980_2.png) [@Lisa\_Jung](https://discuss.elastic.co/u/Lisa_Jung)\
**Post date:** [May 3, 2023, 1:54pm UTC](https://discuss.elastic.co/t/query-on-array-fields-with-null-value/332426/2 "2023-05-03T13:54:24Z")

</div>

Hi @dhggw!

While a `null` value cannot be indexed or searched, there is a `null_value` parameter which allows you to replace explicit `null` values with the specified value so that it can be indexed and searched.

Check out this documentation.

> **[null\_value | Elasticsearch Guide \[8.7\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/null-value.html)**

---

<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 31, 2023, 1:55pm UTC](https://discuss.elastic.co/t/query-on-array-fields-with-null-value/332426/3 "2023-05-31T13:55:18Z")

</div>

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