mongoosesastic没有生活联系

时间:2015-05-12 02:57:17

标签: node.js elasticsearch mongoose mongoosastic

我试图将mongoose方案插入带有mongoosastic的elasticsearch中 但它给了我 { [Error: No Living connections] message: 'No Living connections' }

我的猫鼬模式:

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;

我可以卷曲到弹性搜索服务器,所以没有问题

1 个答案:

答案 0 :(得分:3)

通过在数组中传递我的ip来修复它

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

必须是mongoosastic中的错误