prototype for migrate elasticsearch indices
This library streamify the process export/import data from/to Elasticsearch
elasticsearch
.pipe(new MyModifier1())
.pipe(new MyModifier2())
...
.pipe(new MyModifierN())
.pipe(pack)
.pipe(gzip)
.pipe(file)
;
file
.pipe(gunzip)
.pipe(unpack)
.pipe(new MyModifier1())
.pipe(new MyModifier2())
...
.pipe(new MyModifierN())
.pipe(elasticsearch)
;
Create proto file
npm run proto
Save data from Elasticsearch to file
npm run save
Load data to Elasticsearch from file
npm run load
class MyModifier extends SimpleModifier {
constructor(options) {
super(options);
}
_transform(asset, encoding, callback) {
const newAsset = SomeModifier(asset);
this.push(newAsset);
callback();
}
}
class MyModifier extends SimpleModifier {
constructor(options) {
super(options);
}
_transform(asset, encoding, callback) {
const index = asset.index;
const type = asset.type;
for(let i=0; i<10; i++) {
asset.index = index + '_' + i;
asset.type = type + '_' + i;
this.push(asset);
}
callback();
}
}