express 框架删除elasticsearch索引数据
1.在elasticsearch.js文件下添加
function deleteDocument(id) {
return elasticClient.delete({
index: indexName,
type: "foods",
id: id
});
}
exports.deleteDocument = deleteDocument;
2.在路由删除数据代码块中添加
elastic.deleteDocument(req.body.id).then(function(result) {
res.render('home/publish', {
rss: rs[0]
})
})