// dbInit/index.js "use strict" const dbInit = {}; const bulkData = [ { "index" : { "_index" : "changelog" } }, { "author" : "John Ripper { console.log( "Index 'changelog' created with success."); // seed if flag ok if( ! seed ){ return true; }; this.client.bulk({ index: "changelog", body: this.bulkData }).then( (r) => { console.log( "bulk insert OK"); }, (r) => { console.log( "bulk insert ERROR! : ",r); }); },( result ) => { console.log( "Index 'changelog' already exists, skipping."); }); this.client.indices.create({ index : "changelog-trash", body: { mappings: this.mappings } }).then( (result) => { console.log( "Index 'changelog-trash' created with success."); },( result ) => { console.log( "Index changelog-trash exists, skipping."); }); }; module.exports = dbInit; // EOF