# How to don't save empty fields in elastic search?

**URL:** https://discuss.elastic.co/t/how-to-dont-save-empty-fields-in-elastic-search/205980
**Category:** Elasticsearch
**Created:** [October 31, 2019, 6:17am UTC](https://discuss.elastic.co/t/how-to-dont-save-empty-fields-in-elastic-search/205980 "2019-10-31T06:17:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Mehrdad.dev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mehrdad.dev/32/56326_2.png) [@Mehrdad.dev](https://discuss.elastic.co/u/Mehrdad.dev)
#### Post date: [October 31, 2019, 6:17am UTC](https://discuss.elastic.co/t/how-to-dont-save-empty-fields-in-elastic-search/205980/1 "2019-10-31T06:17:47Z")

</div>

Hi .  
i want store data in elastic search with regardless empty data in some fields.  
if a filed be empty don't store this filed.

can you help me ?

---

<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: [October 31, 2019, 8:21am UTC](https://discuss.elastic.co/t/how-to-dont-save-empty-fields-in-elastic-search/205980/2 "2019-10-31T08:21:31Z")

</div>

If the field is empty it won't be indexed.  
But it will remain as part of the source document as elasticsearch does not touch the JSON you are sending.

You should just control that in your application, that'd be much better.

---

<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: [November 28, 2019, 8:21am UTC](https://discuss.elastic.co/t/how-to-dont-save-empty-fields-in-elastic-search/205980/3 "2019-11-28T08:21:40Z")

</div>

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