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

Suppose I have two tables like this in postgres:

User

  • id
  • name
  • country_id

Country

  • id
  • name

Now when I do:

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

I need data to be denormalized in elasticsearch like this:

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

But it is coming out as flat.

Am I doing something wrong here? I followed this article.

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