Install Elastic Search server

Download and install

https://www.elastic.co/downloads/elasticsearch

  1. Download and unzip the latest Elasticsearch distribution

  2. Run bin/elasticsearch on Unix or sudo dpkg -i elasticsearch-xxx.deb

  3. Run curl -X GET http://localhost:9200/

Install and set “mongoosastic” nodejs module

npm install --save mongoosastic

server: blog.model.js:

[js]
var mongoosastic = require(‘mongoosastic’);

var BlogSchema = new mongoose.Schema({

});

BlogSchema.methods = {

};

BlogSchema.plugin(mongoosastic);
export default mongoose.model(‘Blog’, BlogSchema);

[/js]

Locate “BlogSchema.plugin(mongoosastic);” just before “export default mongoose.model(‘Blog’, BlogSchema);”.

Leave a Reply