配置Logstash以使用嵌套数组

时间:2017-08-07 13:09:11

标签: elasticsearch logstash logstash-grok logstash-configuration logstash-jdbc

我使用Logstash JDBC输入插件为Elasticsearch索引我的PostgreSQL数据。我有两个名为REQUESTASSIGNMENT的表格,如下所示。

如何使用Logstash将两个表索引为一个类型为REQUEST的Elasticsearch文档,其中包含所有子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"
    }
  ]
}

0 个答案:

没有答案