Mongoosesastic no live connection

I am trying to insert my mongoose pattern into elasticsearch using mongoosastic but this gives me { [Error: No Living connections] message: 'No Living connections' }

my mongoose pattern:

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 twist to elasticsearch server, so no problem there

+3
source share
1 answer

Fixed it by passing my ip to array

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

must be a mistake in mongoosastic

+3
source

Source: https://habr.com/ru/post/1617044/


All Articles