elasticsearch-extend
v0.1.2
Published
extended elasticsearch with ODM functions
Downloads
3
Readme
elasticsearch-extend
Extended official elasticsearch module with ODM functions
Features
- Compatible with official elasticsearch
- ES6 syntax(generator, class, etc).
How to use
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');
APIs
es.connect(params)
Connect to an elasticsearch server
es.isConnected
Indicate whether elasticsearch connected or not
es.model(modelName, mapping)
Register a model
es.model(modelName)
Get a model
Model APIs
model.createOne(params)
Create one document
model.list(params)
List documents
ToDos
- More model APIs
- Document APIs