ductile
Version:
Elasticsearch Bulk Loader
95 lines (81 loc) • 2.24 kB
JavaScript
// Generated by CoffeeScript 1.11.1
(function() {
var alias, mappings, mixin, parse, queryToSearch, reader, settings, template, wait, writer;
parse = require('./parse');
mixin = require('./mixin');
reader = require('./reader');
alias = require('./alias');
mappings = require('./mappings');
settings = require('./settings');
template = require('./template');
writer = require('./writer');
queryToSearch = require('./query-to-search');
wait = function() {
return new Promise(function(rs) {
return setTimeout((function() {
return rs();
}), 1000);
});
};
module.exports = function(url) {
var client, search, target;
target = parse(url);
client = require('./es')(target);
search = queryToSearch(target.query);
return {
reader: function(lsearch, operdelete, trans) {
var msearch;
msearch = mixin(search, lsearch, {
index: target.index,
type: target.type
});
return reader(client, msearch, operdelete, trans);
},
wait: function(wantwait) {
var _self, dowait;
_self = this;
if (!wantwait) {
return Promise.resolve(_self);
}
dowait = function() {
return wait().then(function() {
return client.ping();
}).then(function() {
return _self;
})["catch"](function(err) {
return dowait();
});
};
return dowait();
},
alias: function() {
return alias(client, {
index: target.index
});
},
settings: function() {
return settings(client, {
index: target.index
});
},
mappings: function() {
return mappings(client, {
index: target.index,
type: target.type
});
},
template: function() {
return template(client, {
name: target.index
});
},
writer: function(operdelete, trans, instream) {
return writer(client, {
index: target.index,
type: target.type
}, operdelete, trans, instream);
}
};
};
}).call(this);
//# sourceMappingURL=ductile.js.map