# How to iterate through several elements and create a new field with the content of each element

**URL:** <https://discuss.elastic.co/t/how-to-iterate-through-several-elements-and-create-a-new-field-with-the-content-of-each-element/215656>\
**Category:** Logstash\
**Created:** [January 20, 2020, 12:10am UTC](https://discuss.elastic.co/t/how-to-iterate-through-several-elements-and-create-a-new-field-with-the-content-of-each-element/215656 "2020-01-20T00:10:13Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![alejovaz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alejovaz/32/61164_2.png) [@alejovaz](https://discuss.elastic.co/u/alejovaz)\
**Post date:** [January 21, 2020, 12:09pm UTC](https://discuss.elastic.co/t/how-to-iterate-through-several-elements-and-create-a-new-field-with-the-content-of-each-element/215656/3 "2020-01-21T12:09:25Z")

</div>

Thanks @Badger, I used [this code](https://discuss.elastic.co/t/set-fields-into-array-solved/73995/3) of @adrianolimit and solve the problem.

The ruby filter is a powerfull and needed tool.

Thanks.

---

_[View the full topic](https://discuss.elastic.co/t/how-to-iterate-through-several-elements-and-create-a-new-field-with-the-content-of-each-element/215656)._
