Я не могу найти свою ошибку, я пытаюсь вставить массив элемента в Elastic Search, используя метод bulk с библиотекомasticsearch.
Заранее спасибо.
InserTweets: function (arrayobj, callback) {
var items=[];
var count=1;
arrayobj.forEach(element => {
items.push({ index: { _index: 'twitter', _type: 'tweet', _id: count }},element);
count++;
});
console.log(items);
client.bulk({body: [items]}, function (err, resp, status) {
callback(err, resp, status);
});
}
Ошибка:
{ error:
{ root_cause: [ [Object] ],
type: 'parse_exception',
reason: 'Failed to derive xcontent' },
status: 400 }