# Logstash jdbc plugin - nested data

**URL:** https://discuss.elastic.co/t/logstash-jdbc-plugin-nested-data/33908
**Category:** Logstash
**Created:** [November 5, 2015, 6:19pm UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-nested-data/33908 "2015-11-05T18:19:39Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![jrizzi1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jrizzi1/32/1627_2.png) [@jrizzi1](https://discuss.elastic.co/u/jrizzi1)
#### Post date: [November 5, 2015, 6:19pm UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-nested-data/33908/1 "2015-11-05T18:19:39Z")

</div>

I am in process of attempting to migrate from using the old jdbc river plugin to using logstash 1.5 / logstash jdbc plugin

I am however running into some difficulty, if i previously had 50 rows with 20 having unique id's,  
like 20 customers, but several customers have more than one mailing address

the results would fold the sql into nested fields for my document during bulk insertion

```
{
            "_index": "matchstick",
            "_id": "0000117947",
            "_score": 1,
            "_source": {
               "id_number": "0000117947",
               "pref_mail_name": "Joanne Reaume",
               "street1": [
                  "364 Lexington Cir",
                  "1751 Hawthorne Rd"
               ],
               "street2": " ",
               "street3": " ",
               "city": [
                  "Romeo",
                  "Grosse Pointe Woods"
               ],
               "state_code": "MI",
               "zipcode": [
                  "48065-3006",
                  "48236-1447"
               ],
            }
         },

```

when i run the logstash-jdbc-plugin, it seems to just replace the document each time a row is encountered , creating a new version, not creating any nested fields

```
{
   "_index": "matchstick",
   "_type": "logs",
   "_id": "0000117947",
   "_version": 2,
   "found": true,
   "_source": {
      "id_number": "0000117947",
      "pref_mail_name": "Joanne Reaume",
      "street1": "1751 Hawthorne Rd",
      "street2": " ",
      "street3": " ",
      "city": "Grosse Pointe Woods",
      "state_code": "MI",
      "zipcode": "48236-1447",
      "first_name": "Joanne",
      "middle_name": " ",
      "last_name": "Reaume",
      "email_address": null,
      "@version": "1",
      "@timestamp": "2015-11-05T18:13:56.780Z"
   }
}

```

is there any way to fold query results to nested fields?

---

<div class="post-metadata">

### Author: ![Architha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/architha/32/92477_2.png) [@Architha](https://discuss.elastic.co/u/Architha)
#### Post date: [February 16, 2016, 7:31am UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-nested-data/33908/2 "2016-02-16T07:31:53Z")

</div>

@jrizzi1

Hi, have you solved this issue ? I am facing a similar situation.  
Kindly revert if you have a solution . Thanks!

---

<div class="post-metadata">

### Author: ![ChrisR](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@ChrisR](https://discuss.elastic.co/u/ChrisR)
#### Post date: [June 21, 2016, 7:04pm UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-nested-data/33908/3 "2016-06-21T19:04:13Z")

</div>

Any luck? I have the same issue.

---

<div class="post-metadata">

### Author: ![Architha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/architha/32/92477_2.png) [@Architha](https://discuss.elastic.co/u/Architha)
#### Post date: [June 30, 2016, 10:40am UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-nested-data/33908/4 "2016-06-30T10:40:09Z")

</div>

No luck ! Solved this issue by avoiding Logstash and building a custom ETL tool.

---

<div class="post-metadata">

### Author: ![ChrisR](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@ChrisR](https://discuss.elastic.co/u/ChrisR)
#### Post date: [June 30, 2016, 2:02pm UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-nested-data/33908/5 "2016-06-30T14:02:36Z")

</div>

I did the same, built a custom ETL tool. However, elasticsearch always aggregates at the document level, never at the nested object level, so the value of nested objects is a bit more limited than I had thought.

---

<div class="post-metadata">

### Author: ![Syed\_Ather](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/syed_ather/32/11778_2.png) [@Syed\_Ather](https://discuss.elastic.co/u/Syed_Ather)
#### Post date: [September 7, 2016, 5:07pm UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-nested-data/33908/6 "2016-09-07T17:07:46Z")

</div>

@magnusbaeck That is something that should have been a part of the jdbc plugin as well right? its pretty handy as we do not have to go to third party apps to take care of data uploads to elastic in a certain structure.

---

<div class="post-metadata">

### Author: ![Syed\_Ather](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/syed_ather/32/11778_2.png) [@Syed\_Ather](https://discuss.elastic.co/u/Syed_Ather)
#### Post date: [September 7, 2016, 5:08pm UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-nested-data/33908/7 "2016-09-07T17:08:24Z")

</div>

@Architha can you please share the ETL here?

---

<div class="post-metadata">

### Author: ![Syed\_Ather](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/syed_ather/32/11778_2.png) [@Syed\_Ather](https://discuss.elastic.co/u/Syed_Ather)
#### Post date: [September 7, 2016, 5:13pm UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-nested-data/33908/8 "2016-09-07T17:13:55Z")

</div>

@jrizzi1 can you share the jdbc river config ?

---

<div class="post-metadata">

### Author: ![jrizzi1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jrizzi1/32/1627_2.png) [@jrizzi1](https://discuss.elastic.co/u/jrizzi1)
#### Post date: [September 7, 2016, 5:25pm UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-nested-data/33908/9 "2016-09-07T17:25:31Z")

</div>

my river config gets the same issue im describing, it hasnt been fixed as  
there's been no movement towards fixing it

---

<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 6, 2017, 4:39am UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-nested-data/33908/10 "2017-07-06T04:39:28Z")

</div>


