【发布时间】:2020-07-08 01:58:47
【问题描述】:
let elasticsearch = require('elasticsearch');
let client = new elasticsearch.Client({
host: "*********************",
});
let temp = await client.update({
index: container,
id: 1,
type: '_doc',
body: {"name": "rks", "visible": true},
doc_as_upsert: true,
})
此查询的响应返回
"result": {
"_index": "container",
"_type": "_doc",
"_id": "1",
"_version": 2,
"result": "updated",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"_seq_no": 1,
"_primary_term": 1
}
如何在响应中返回更新后的文档。有什么方法/方法可以实现这个目标。请帮帮我
【问题讨论】:
-
您需要在更新后执行 GET 以获得最新版本的文档
-
感谢您的回复。但我没有兴趣使用另一个 API 来获得结果。
-
这就是它的工作原理:-)
标签: node.js elasticsearch amazon-elastic-beanstalk