# How to index nested mysql object into elasticsearch using logstash?

**URL:** https://discuss.elastic.co/t/how-to-index-nested-mysql-object-into-elasticsearch-using-logstash/47600
**Category:** Logstash
**Created:** [April 18, 2016, 3:18am UTC](https://discuss.elastic.co/t/how-to-index-nested-mysql-object-into-elasticsearch-using-logstash/47600 "2016-04-18T03:18:55Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Yangrui\_Guo](https://avatars.discourse-cdn.com/v4/letter/y/4bbf92/32.png) [@Yangrui\_Guo](https://discuss.elastic.co/u/Yangrui_Guo)
#### Post date: [April 18, 2016, 3:18am UTC](https://discuss.elastic.co/t/how-to-index-nested-mysql-object-into-elasticsearch-using-logstash/47600/1 "2016-04-18T03:18:56Z")

</div>

I'm trying to index mysql database with elasticsearch. Consider the example mapping:

```
{"blog":
  {"properties": 
    {"id": "string"}
    {"author": "string"}
    {"time_created": }
    {"author_info": 
      {"author_name":}
      {"author_sex":}
    }
    {"posts":
      {"post_author":}
      {"post_time":}
    }
  }
}

```

I have three tables which are author\_info, blog and post. How can I index these records into elastic with a nested structure? I cannot find documents about it. Thanks

---

<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: [April 18, 2016, 9:11pm UTC](https://discuss.elastic.co/t/how-to-index-nested-mysql-object-into-elasticsearch-using-logstash/47600/2 "2016-04-18T21:11:26Z")

</div>

What part are you having trouble with? Join the database tables and use a mutate filter to move the resulting fields into the desired structure.

---

<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, 5:01am UTC](https://discuss.elastic.co/t/how-to-index-nested-mysql-object-into-elasticsearch-using-logstash/47600/3 "2017-07-06T05:01:46Z")

</div>


