Extended official elasticsearch module with ODM functions
- Compatible with official elasticsearch
- ES6 syntax(generator, class, etc).
Init es connection:
const es = require('elasticsearch-extend');
es.connect({
host: 'localhost:9200',
log: 'info'
})
.then(function(){ ... })
.catch(function(error){ ... });
Once connected, register a model:
const UserModel = es.model('user', {
username: { type: "string"},
phone: { type: "string"}
});
Get a registered model:
const UserModel = es.model('user');
Connect to an elasticsearch server
Indicate whether elasticsearch connected or not
Register a model
Get a model
Create one document
List documents
- More model APIs
- Document APIs