UNPKG

mongoose-elasticsearch-xp

Version:

A mongoose plugin that indexes models into elastic search (an alternative to mongoosastic)

21 lines (17 loc) 470 B
var elasticsearch = require('elasticsearch'); module.exports = function (options) { var opts = {}; if (Array.isArray(options.hosts)) { opts.host = options.hosts; } else { opts.host = { host: options.host || '192.168.0.57', port: options.port || 9200, protocol: options.protocol || 'http', auth: options.auth || null, keepAlive: false }; } opts.log = options.log || null; return new elasticsearch.Client(opts); };