I'm new at elastic and I'm facing error...I try to follow documentation and some tutorial that I found but on first step I get error that I'm not able to fix :(
This is my code
const mongoose = require('mongoose')
const mongoosastic = require('mongoosastic')
const userSchema = new mongoose.Schema({
name: { type: String, es_indexed: true },
email: { type: String },
city: { type: String }
})
userSchema.plugin(mongoosastic, {
"host": "localhost",
"port": 9200
})
const User = mongoose.model('elastic', userSchema);
User.createMapping(function (err, mapping) {
if (err) {
console.log("error creating mapping");
console.log(err);
} else {
console.log("Mapping successfully created");
console.log(mapping);
}
});
module.exports = User;