# Importing into nested document using logstash

**URL:** <https://discuss.elastic.co/t/importing-into-nested-document-using-logstash/98407>\
**Category:** Logstash\
**Created:** [August 25, 2017, 6:59pm UTC](https://discuss.elastic.co/t/importing-into-nested-document-using-logstash/98407 "2017-08-25T18:59:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aditya8003](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@aditya8003](https://discuss.elastic.co/u/aditya8003)\
**Post date:** [August 25, 2017, 6:59pm UTC](https://discuss.elastic.co/t/importing-into-nested-document-using-logstash/98407/1 "2017-08-25T18:59:16Z")

</div>

How do I feed nested data like the one below using Logstash extracted from a CSV file?

I checked out the below posts but couldnt find a solution built into logstash that helps convert a flat row from a database or an excel sheet into nested JSON that can be fed into elasticsearch.

> [@Access nested fields in mutate filter](https://discuss.elastic.co/t/access-nested-fields-in-mutate-filter/58172):
>
> Hello, I would like to ask a question regarding accessing nested fields in logstash. There is "processes" object in my JSON which has nested field "Name". I would like to extract the field value from the nested object to separate field. This is working: mutate{ add\_field =\> { "Name" =\> "%{processes[Name]}" } } Then suppose that there is also "columns" object in my JSON, which contains names of fields of the "processes" object: "columns":["Offset(V)","Name","PID","PPID","Thds","Hnds","Ses…

[https://discuss.elastic.co/search?q=import%20into%20nested%20fields](https://discuss.elastic.co/search?q=import%20into%20nested%20fields)

> [@How to use jdbc to import data into nested objects?](https://discuss.elastic.co/t/how-to-use-jdbc-to-import-data-into-nested-objects/52871):
>
> Hi everybody, I have multiple tables in my database which I would like to import into Elasticsearch using a single document type. One of the tables has a one-to-many relation to another table. I will use the example as provided in the guide to explain the problem, because my problem is similar ([https://www.elastic.co/guide/en/elasticsearch/guide/current/nested-objects.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/nested-objects.html)). So we have blogposts (in one table) and each blogpost can have multiple comments (in another table, linked with a one-to…

“partterm” : {  
“type” : “nested”,  
“properties” : {  
“amoe” : {  
“type” : “text”,  
“index” : false  
},  
“buyersguide” : {  
“properties” : {  
“P” : {  
“properties” : {  
“I” : {  
“type” : “text”,  
“fields” : {  
“keyword” : {  
“type” : “keyword”,  
“ignore\_above” : 256  
}  
}  
},  
“M” : {  
“properties” : {  
“FY” : {  
“type” : “text”,  
“fields” : {  
“keyword” : {  
“type” : “keyword”,  
“ignore\_above” : 256  
}  
}  
},  
“I” : {  
“type” : “text”,  
“fields” : {  
“keyword” : {  
“type” : “keyword”,  
“ignore\_above” : 256  
}  
}  
},  
“MO” : {  
“properties” : {  
“E” : {  
“properties” : {  
“I” : {  
“type” : “text”,  
“fields” : {  
“keyword” : {  
“type” : “keyword”,  
“ignore\_above” : 256  
}  
}  
},

---

<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:** [September 22, 2017, 6:59pm UTC](https://discuss.elastic.co/t/importing-into-nested-document-using-logstash/98407/2 "2017-09-22T18:59:18Z")

</div>

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