elasticsearch js{body}未定义

vddsk6oq  于 2021-06-13  发布在  ElasticSearch
关注(0)|答案(0)|浏览(316)

我在运行aws lambda函数将数据推入elasticsearch示例时遇到了这个错误如果我手动从节点模块中删除{body},我可以让它运行,但是我找不到为什么它一直在出错。

我的代码

client.helpers.bulk({
        datasource: docs,
        onDocument(doc) {
            return {
                index: { _index: index , _id: doc.id },
                body: doc.body
           }
        },
        onDrop(doc) {
            console.log("failed to index ", doc.key);
        },
        retries: 5,
        flushBytes: 1000000,
        wait: 10000

    })

错误

{
    "errorType": "Runtime.UnhandledPromiseRejection",
    "errorMessage": "TypeError: Cannot destructure property 'body' of 'undefined' as it is undefined.",
    "reason": {
        "errorType": "TypeError",
        "errorMessage": "Cannot destructure property 'body' of 'undefined' as it is undefined.",
        "stack": [
            "TypeError: Cannot destructure property 'body' of 'undefined' as it is undefined.",
            "    at /var/task/node_modules/@elastic/elasticsearch/lib/Helpers.js:679:81"
        ]
    },
    "promise": {},
    "stack": [
        "Runtime.UnhandledPromiseRejection: TypeError: Cannot destructure property 'body' of 'undefined' as it is undefined.",
        "    at process.<anonymous> (/var/runtime/index.js:35:15)",
        "    at process.emit (events.js:314:20)",
        "    at process.EventEmitter.emit (domain.js:483:12)",
        "    at processPromiseRejections (internal/process/promises.js:209:33)",
        "    at processTicksAndRejections (internal/process/task_queues.js:98:32)"
    ]
}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题