麻醉无生活连接 [英] mongoosesastic no living connection

查看:214
本文介绍了麻醉无生活连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用mongoosastic
插入我的mongoose计划到弹性搜索,但它给我
{[错误:没有生活的连接]消息:'没有生活的连接'}

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

我的mongoose架构:

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

推荐答案

通过将数组传递给数组来修复它

Fixed it by passing my ip in an array

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

必须是mongoosastic中的错误

must be a bug in mongoosastic

这篇关于麻醉无生活连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆