Last active
December 14, 2016 19:53
-
-
Save reconbot/f5421674de54ccd9bda7b40a71c017fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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