【发布时间】:2020-08-11 01:01:01
【问题描述】:
当我将文档添加到设置了 _id 的 elasticsearch 时,我得到:
Field [_id] is a metadata field and cannot be added inside a document. Use the index API request parameters.
使用客户端.bulk
const body = dataset.flatMap(doc => [{ index: { _index: 'myindex' } }, doc])
const { body: bulkResponse } = await client.bulk({ refresh: true, body })
我没有看到在参数中放置 _id 的地方。
https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html
我应该使用其他方法吗?
谢谢。
【问题讨论】:
标签: javascript node.js elasticsearch