# Add Nested document into the elasticsearch via logstash

**URL:** https://discuss.elastic.co/t/add-nested-document-into-the-elasticsearch-via-logstash/237660
**Category:** Elasticsearch
**Created:** [June 18, 2020, 3:10pm UTC](https://discuss.elastic.co/t/add-nested-document-into-the-elasticsearch-via-logstash/237660 "2020-06-18T15:10:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Siva\_Samraj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/siva_samraj/32/70642_2.png) [@Siva\_Samraj](https://discuss.elastic.co/u/Siva_Samraj)
#### Post date: [June 18, 2020, 3:10pm UTC](https://discuss.elastic.co/t/add-nested-document-into-the-elasticsearch-via-logstash/237660/1 "2020-06-18T15:10:28Z")

</div>

` I have a problem, multiple events will come from Kafka for the same message-id. I want to use logstash to push the events into elastic search in a nested documents. How we can push the data into elasticsearch via logstash as nested documents.

Can someone help in this regards?

Example:

1. Msg\_id - m1 event - msg\_requested timestamp - 1234
2. Msg\_id - m1 event - msg\_received timestmap - 1235
3. Msg\_id - m1 event - msg\_delivered timestmap - 1236

These events can come in different timestamp, the first event for the msg\_id will create the parent doc. I want the data inside the elastic search to be looks like

"ts": "1234", "id": "m1", "sets": [{ "ts": "1234", "et": "msg\_requested" }, { "ts": "1235", "et": "msg\_received" }, { "ts": "1236", "et": "msg\_delivered" }] } `

---

<div class="post-metadata">

### Author: ![Siva\_Samraj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/siva_samraj/32/70642_2.png) [@Siva\_Samraj](https://discuss.elastic.co/u/Siva_Samraj)
#### Post date: [June 19, 2020, 3:20am UTC](https://discuss.elastic.co/t/add-nested-document-into-the-elasticsearch-via-logstash/237660/2 "2020-06-19T03:20:58Z")

</div>

Can someone help on this?

---

<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: [July 17, 2020, 3:21am UTC](https://discuss.elastic.co/t/add-nested-document-into-the-elasticsearch-via-logstash/237660/3 "2020-07-17T03:21:04Z")

</div>

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