【发布时间】:2020-01-08 01:43:51
【问题描述】:
我正在尝试将 600MB Json 文件(将来可能会放大)插入到 elasticsearch。 但是,我得到以下错误,
Error: "toString()" failed
我正在使用 stream-json npm 但没有运气:( 做这个的最好方式是什么? 我正在考虑分块,但如果有更好的方法,那就太好了
var makeBulk = function(csList, callback){
const pipeline = fs.createReadStream('./CombinedServices_IBC.json').pipe(StreamValues.withParser());
while()
pipeline.on('data', data => {
for(var index in data.value.features){
bulk.push(
{ index: {_index: 'combinedservices1', _type: '_doc', _id: data.value.features[index].properties.OBJECTID } },
{
'geometry': data.value.features[index].geometry,
'properties': data.value.features[index].properties
}
);
}
callback(bulk);
});
}
【问题讨论】:
-
您是如何将大型 GeoJson 上传到 ElasticSearch 的?
标签: json node.js elasticsearch npm kibana