我正在使用 Logstash JDBC 输入插件为 Elasticsearch 索引我的 PostgreSQL 数据。我有两个表调用REQUEST
并ASSIGNMENT
在下面列出。
如何使用 Logstash 将这两个表索引到一个 Elasticsearch 类型的文档中,REQUEST
其中包含所有子ASSIGNMENT
记录的嵌套数组?
Table: REQUEST
REQUEST_ID | POC
---------- | ----------------
1234 | Jon Snow
1256 | Tyrion Lannister
Table: ASSIGNMENT
ASSIGN_ID | REQUEST_ID | STATUS | CREATED
--------- | ---------- | ------- | ----------
2345 | 1234 | New | 2017-01-06
2364 | 1234 | Working | 2017-03-12
2399 | 1234 | Working | 2017-05-20
5736 | 1256 | New | 2017-06-28
这就是我希望我的 Elasticsearch 文档看起来的样子。它是_source
搜索结果值的样本:
"_source": {
"request_id": "1234",
"poc": "Jon Snow",
"assignments": [
{
"assign_id": "2345",
"status": "New",
"created": "2017-01-06"
},
{
"assign_id": "2364",
"status": "Working",
"created": "2017-03-12"
},
{
"assign_id": "2399",
"status": "Working",
"created": "2017-05-20"
}
]
}