Skip to content

Instantly share code, notes, and snippets.

@reconbot
Last active December 14, 2016 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reconbot/f5421674de54ccd9bda7b40a71c017fe to your computer and use it in GitHub Desktop.
Save reconbot/f5421674de54ccd9bda7b40a71c017fe to your computer and use it in GitHub Desktop.
// This is what elastic search wants for promises, bluebird says it's horrible
// https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/configuration.html#config-defer
// http://bluebirdjs.com/docs/api/deferred-migration.html
function defer () {
let resolve, reject
var promise = new Promise(function makeDefer () {
resolve = arguments[0]
reject = arguments[1]
})
return {
resolve,
reject,
promise
}
}
let opts = {
hosts: config.user.esHost,
connectionClass: httpAwsEs,
amazonES: awsConfig,
defer
}
module.exports = new es.Client(opts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment