# Packetbeat: publish an event with nested objects to elasticsearch in go

**URL:** <https://discuss.elastic.co/t/packetbeat-publish-an-event-with-nested-objects-to-elasticsearch-in-go/71957>\
**Category:** Beats\
**Tags:** packetbeat\
**Created:** [January 18, 2017, 9:13am UTC](https://discuss.elastic.co/t/packetbeat-publish-an-event-with-nested-objects-to-elasticsearch-in-go/71957 "2017-01-18T09:13:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sumit419](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sumit419](https://discuss.elastic.co/u/sumit419)\
**Post date:** [January 18, 2017, 9:13am UTC](https://discuss.elastic.co/t/packetbeat-publish-an-event-with-nested-objects-to-elasticsearch-in-go/71957/1 "2017-01-18T09:13:10Z")

</div>

Hi,  
I have a custom plugin that generates a list of struct objects. something like [{field 1: value,field 2: value},{field 1: value,field 2: value},,,,] for request field.

I updated the elasticsearch template and set type: nested for my plugin event mapping. How do i assign these values to the fields in go. using Mapstr.

indexing didnt help for event fields.

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [January 18, 2017, 2:52pm UTC](https://discuss.elastic.co/t/packetbeat-publish-an-event-with-nested-objects-to-elasticsearch-in-go/71957/2 "2017-01-18T14:52:15Z")

</div>

You have some sample code? Just assigning your struct might work (given symbols are exported). Otherwise you have to transform your structs into MapStr yourself.

---

<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:** [February 15, 2017, 2:52pm UTC](https://discuss.elastic.co/t/packetbeat-publish-an-event-with-nested-objects-to-elasticsearch-in-go/71957/3 "2017-02-15T14:52:25Z")

</div>

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