# Remove fields from documents based on their value

**URL:** https://discuss.elastic.co/t/remove-fields-from-documents-based-on-their-value/200270
**Category:** Logstash
**Created:** [September 19, 2019, 4:37pm UTC](https://discuss.elastic.co/t/remove-fields-from-documents-based-on-their-value/200270 "2019-09-19T16:37:16Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [September 19, 2019, 4:50pm UTC](https://discuss.elastic.co/t/remove-fields-from-documents-based-on-their-value/200270/2 "2019-09-19T16:50:52Z")

</div>

The [update API](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html) can be used to delete fields. You could use a ruby script to iterate over the fields of an event and generate a list of empty fields.

---

_[View the full topic](https://discuss.elastic.co/t/remove-fields-from-documents-based-on-their-value/200270)._
