【发布时间】:2015-12-03 18:41:28
【问题描述】:
我正在尝试在将 json 数据上传到 elasticsearch 之前创建映射。 在sails.js中上传json数据之前不知道怎么实现映射
这是我的批量上传 sn-p
var body = [];
//row is json data
rows.forEach(function(row, id) {
body.push({ index: { _index: 'testindex', _type: 'testtype', _id: (id+1) } });
body.push(row);
})
client.bulk({
body: body
}, function (err, resp) {
if (err)
{
console.log(err);
return;
}
else
{
console.log("All Is Well");
}
});
我想在数据上传之前创建映射。有人知道如何在sails中创建映射。
我的 Json 对象
[ { Name: 'paranthn', Age: '43', Address: 'trichy' },
{ Name: 'Arthick', Age: '23', Address: 'trichy' },
{ Name: 'vel', Age: '24', Address: 'trichy' } ]
【问题讨论】:
标签: json node.js elasticsearch sails.js