# Ruby filter to whitelist nested fields

**URL:** https://discuss.elastic.co/t/ruby-filter-to-whitelist-nested-fields/298424
**Category:** Logstash
**Created:** [February 28, 2022, 3:43pm UTC](https://discuss.elastic.co/t/ruby-filter-to-whitelist-nested-fields/298424 "2022-02-28T15:43:13Z")
**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: [February 28, 2022, 5:18pm UTC](https://discuss.elastic.co/t/ruby-filter-to-whitelist-nested-fields/298424/2 "2022-02-28T17:18:53Z")

</div>

If you need to iterate over the contents of objects in the event then you would use a ruby filter like [this](https://discuss.elastic.co/t/how-to-exclude-xml-json-key-value-if-key-length-is-greater-than-15-char-and-value-length-is-greater-than-100-char/270248/8). However, it is hard for me to even think of a syntax that would allow one to specify which nested fields should be whitelisted when an object can contain arrays within hashes and hashes within arrays.

---

_[View the full topic](https://discuss.elastic.co/t/ruby-filter-to-whitelist-nested-fields/298424)._
