# How to use logstash-jdbc-input-plugin and also denormalize data?

**URL:** <https://discuss.elastic.co/t/how-to-use-logstash-jdbc-input-plugin-and-also-denormalize-data/79166>\
**Category:** Logstash\
**Created:** [March 19, 2017, 10:10am UTC](https://discuss.elastic.co/t/how-to-use-logstash-jdbc-input-plugin-and-also-denormalize-data/79166 "2017-03-19T10:10:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhinavzspace](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@abhinavzspace](https://discuss.elastic.co/u/abhinavzspace)\
**Post date:** [March 19, 2017, 10:10am UTC](https://discuss.elastic.co/t/how-to-use-logstash-jdbc-input-plugin-and-also-denormalize-data/79166/1 "2017-03-19T10:10:06Z")

</div>

Suppose I have two tables like this in postgres:

User

- id
- name
- country\_id

Country

- id
- name

Now when I do:

```auto
jdbc {
    ...
    statement => "SELECT * FROM user JOIN country ON country.id = user.country_id"
}

```

I need data to be denormalized in elasticsearch like this:

```auto
{
  "name": "David",
  "country": {
     "name": "France"
  }
}

```

But it is coming out as flat.

Am I doing something wrong here? I followed [this](https://www.elastic.co/blog/logstash-jdbc-input-plugin) article.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [March 20, 2017, 7:22am UTC](https://discuss.elastic.co/t/how-to-use-logstash-jdbc-input-plugin-and-also-denormalize-data/79166/2 "2017-03-20T07:22:20Z")

</div>

This is expected. Logstash won't automatically create nested fields from the query results.

---

<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 17, 2017, 7:22am UTC](https://discuss.elastic.co/t/how-to-use-logstash-jdbc-input-plugin-and-also-denormalize-data/79166/3 "2017-04-17T07:22:42Z")

</div>

Closed on April 17, 2017, 7:22am UTC

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