# Elasticsearch declare field as null

**URL:** https://discuss.elastic.co/t/elasticsearch-declare-field-as-null/120838
**Category:** Elasticsearch
**Created:** [February 21, 2018, 12:53pm UTC](https://discuss.elastic.co/t/elasticsearch-declare-field-as-null/120838 "2018-02-21T12:53:19Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![HilalB](https://avatars.discourse-cdn.com/v4/letter/h/e95f7d/32.png) [@HilalB](https://discuss.elastic.co/u/HilalB)
#### Post date: [February 21, 2018, 12:53pm UTC](https://discuss.elastic.co/t/elasticsearch-declare-field-as-null/120838/1 "2018-02-21T12:53:19Z")

</div>

I would like to declare a field to null not with null\_value.

Are "" and null equivalent? If I do not write anything to field, will ES set set the null automatically?

Is empty string stored in doc?

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [February 21, 2018, 1:14pm UTC](https://discuss.elastic.co/t/elasticsearch-declare-field-as-null/120838/2 "2018-02-21T13:14:23Z")

</div>

> If I do not write anything to field, will ES set set the null automatically?

Yes. And that's the best approach.

---

<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: [March 21, 2018, 1:14pm UTC](https://discuss.elastic.co/t/elasticsearch-declare-field-as-null/120838/3 "2018-03-21T13:14:37Z")

</div>

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