【发布时间】:2019-06-03 06:33:34
【问题描述】:
我真的不明白为什么当我运行批量插入时,我在没有执行任何删除操作的情况下丢失了同一个集合中的先前数据? 这很奇怪。
有什么想法吗?
var client = new elasticsearch.Client( {
hosts: [
'http://localhost:9200/'
]
})
。 . .
InserTweets: function (arrayobj, callback) {
var items=[];
var count=1;
arrayobj.forEach(element => {
items.push({ index: { _index: 'twitter', _type: 'tweet', _id: count }},element);
count++;
});
client.bulk({body:items}, function (err, resp, status) {
callback(err, resp, status);
}, function (err, resp, status) {
console.log(err);
});
}
【问题讨论】:
标签: elasticsearch