使用Dataworks同步Elasticsearch至MaxCompute 日期类型为\N的解决办法

问题背景:

如果ES的数据存在日期类型,并且ES的日期类型本身没有dateFormat的话,同步到MaxCompute默认是空值。

如图:

使用Dataworks同步Elasticsearch至MaxCompute 日期类型为\N的解决办法

解决办法:

需要在elasticsearch Reader中增加dateFormat属性,格式和要同步的ES日期格式一致就可以了。
如:

{
    "type": "job",
    "steps": [
        {
            "stepType": "elasticsearch",
            "parameter": {
                "search": "",
                "endpoint": "http://阿里云es地址:9200",
                "password": "密码",
                "dateFormat": "yyyy-MM-dd'T'HH:mm:ss.SSSZZ",
                "retryCount": 3,
                "column": [
                    "created_time"
                ],
                "scroll": "1m",
                "index": "odpstest",
                "type": "doc",
                "username": "elastic"
            },
            "name": "Reader",
            "category": "reader"
        },
        {
            "stepType": "odps",
            "parameter": {
                "partition": "",
                "truncate": true,
                "datasource": "odps_first",
                "column": [
                    "time"
                ],
                "emptyAsNull": false,
                "table": "testtime2"
            },
            "name": "Writer",
            "category": "writer"
        }
    ],
    "version": "2.0",
    "order": {
        "hops": [
            {
                "from": "Reader",
                "to": "Writer"
            }
        ]
    },
    "setting": {
        "errorLimit": {
            "record": ""
        },
        "speed": {
            "throttle": false,
            "concurrent": 2
        }
    }
}

测试结果:
使用Dataworks同步Elasticsearch至MaxCompute 日期类型为\N的解决办法

上一篇:多核内存共享和分布式内存系统的区别


下一篇:使用Dataworks的Pyodps节点发送钉钉机器人消息