logstash同步数据mysql一对多数据结构的情况?

学生表student和课程表class一对多关系,
学生表student和兴趣interest表一对多关系,
想要将三个表同步到一个索引里面,通过ES一次性查询到学生信息、学生的课程数组、学生的兴趣数组;

[
{
"id": 1,
"name": "小王",
"class": [
{
"id": 1,
"name": "数学"
},
{
"id": 2,
"name": " 语文"
}
],
"interest": [
{
"id": 1,
"name": "学习"
},
{
"id": 1,
"name": "足球"
}
]
}]
我是想搜索出来这样的数据 同时包含学生的 课程和兴趣,而这条数据是真实同步到logstash中的 不是通过ES的联合查询出来的

input {
stdin {
}
jdbc {
# mysql jdbc connection string to our backup databse
jdbc_connection_string => "jdbc:mysql://192.168.42.147:3306/test"
# the user we wish to excute our statement as
jdbc_user => "root"
jdbc_password => "root"
# the path to our downloaded jdbc driver
jdbc_driver_library => "/home/hadoop/opt/logstash-2.3.2/mysql-connector-java-5.1.29.jar"
# the name of the driver class for mysql
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_paging_enabled => "true"
jdbc_page_size => "50000"
statement_filepath => "jdbc.sql"
schedule => "* * * * "
type => "gjhz"
}
jdbc {
# mysql jdbc connection string to our backup databse
jdbc_connection_string => "jdbc:mysql://192.168.42.147:3306/test"
# the user we wish to excute our statement as
jdbc_user => "root"
jdbc_password => "root"
# the path to our downloaded jdbc driver
jdbc_driver_library => "/home/hadoop/opt/logstash-2.3.2/mysql-connector-java-5.1.29.jar"
# the name of the driver class for mysql
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_paging_enabled => "true"
jdbc_page_size => "50000"
statement_filepath => "jdbc2.sql"
schedule => "
* * * *"
type => "rjfw"
}
}

网卡,一不小心发了四遍图片说明

[
{
"id": 1,
"name": "小王",
"class": [
{
"id": 1,
"name": "数学"
},
{
"id": 2,
"name": " 语文"
}
],
"interest": [
{
"id": 1,
"name": "学习"
},
{
"id": 1,
"name": "足球"
}
]
}]我是想搜索出来这样的数据 同时包含学生的 课程和兴趣,而这条数据是真实同步到logstash中的 不是通过ES的联合查询出来的

先把表设计写好 再写对表的操作就好写了 应该先看一下这个一对多的表设计https://www.cnblogs.com/fengxuehuanlin/p/5325312.html