3

我正在尝试使用 mongoosastic 将我的 mongoose 方案插入到 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;

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

4

1 回答 1

3

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

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

一定是 mongoosastic 的 bug

于 2015-05-13T02:15:54.630 回答