mongoosesastic no living connection

房东的猫 提交于 2019-12-06 08:22:13

问题


I'm trying to insert my mongoose scheme into elasticsearch with mongoosastic but it gives me { [Error: No Living connections] message: 'No Living connections' }

my mongoose schema:

var mongoose = require( 'mongoose' );
var Schema = mongoose.Schema;
var mongoosastic = require('mongoosastic');
var ProductSchema = new Schema( {
   ----huge load of json----
});

ProductSchema.plugin(mongoosastic,{host:'xxx.xxx.xxx.xxx:9200',curlDebug: true});

mongoose.model('product', ProductSchema);

var product = mongoose.model('product');
product.createMapping(function(err, mapping){
if(err){
    console.log('error creating mapping (you can safely ignore this)');
    console.log(err);
}else{
    console.log('mapping created!');
    console.log(mapping);
}
});
module.exports = product;

I can curl to the elasticsearch server, so no issue there


回答1:


Fixed it by passing my ip in an array

ProductSchema.plugin(mongoosastic,{
hosts: [
    'XXX.XXX.XXX.XXX:9200'
 ]
});

must be a bug in mongoosastic



来源:https://stackoverflow.com/questions/30180979/mongoosesastic-no-living-connection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!