Am new and exploring elasticsearch integration with node and trying to execute the following example in my windows.
while trying to import the data from data.json, the 'node index.js' is able to only parse the items in data file but not indexing those items into my elasticsearch instance.
I am not getting the log statement "Successfully indexed 1000 out of 1000 items" printed.
esClient.bulk({body: bulkBody})
.then(response => {
let errorCount = 0;
response.items.forEach(item => {
if (item.index && item.index.error) {
console.log(++errorCount, item.index.error);
}
});
console.log(Successfully indexed ${data.length - errorCount} out of ${data.length} items);
})
.catch(console.err);
};
Any idea what step is missing here?
java version 1.8.0_121 elasticsearch version 6.1.1 node version v8.5.0
The old version of elasticsearch.js is sending requests with application/x-ldjson which not supported by newer elasticsearch versions.
This issue got resolved after editing the package.json of node-elasticsearch-tutorial project in my local. The version of elasticsearch.js mentioned as 11.0.1 where as the latest one available is 14.0.0.
This brings me the latest version of elasticsearch.js from "npm install elasticsearch".
I am now able to index successfully using the bulk function.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.