# Looping through a logstash event in painless

**URL:** <https://discuss.elastic.co/t/looping-through-a-logstash-event-in-painless/174204>\
**Category:** Elasticsearch\
**Created:** [March 27, 2019, 9:09pm UTC](https://discuss.elastic.co/t/looping-through-a-logstash-event-in-painless/174204 "2019-03-27T21:09:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luksi1](https://avatars.discourse-cdn.com/v4/letter/l/e68b1a/32.png) [@luksi1](https://discuss.elastic.co/u/luksi1)\
**Post date:** [March 27, 2019, 9:09pm UTC](https://discuss.elastic.co/t/looping-through-a-logstash-event-in-painless/174204/1 "2019-03-27T21:09:52Z")

</div>

I'm attempting to loop through an event in the output elasticsearch plugin. I would like to be able to loop through a nested hash and add that information to the document. Right now I'm just grasping at straws...

1. Looping through an event. Am I close?

for (k in params.event.events.keySet()){ }

1. Adding a field to an event. Something like this?

params.event..add("value")

Any help would be appreciated.

---

<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:** [April 24, 2019, 9:09pm UTC](https://discuss.elastic.co/t/looping-through-a-logstash-event-in-painless/174204/2 "2019-04-24T21:09:56Z")

</div>

Closed on April 24, 2019, 9:09pm UTC

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