elasticsearch-module
v1.0.0
Published
A wrapper around functions of elasticsearch.
Downloads
4
Readme
elasticsearch-module
A wrapper around functions of elasticsearch.
Install
$ npm install --save elasticsearch-module
Initializing
var esModule = require('elasticsearch-module')
esModule.init({
baseUrl: 'http://youip:9200/'
});
Add index
var className = 'product';
var data = {
"objectId": "0001",
"user": "dilbert",
"postDate": "2011-12-15",
"body": "Search is hard. Search should be easy." ,
"title": "On search"
};
esModule.add(className, data).then(function(result){
//dosomething() ....
},function(err){
//dosomethingElse() ....
});
Search
var className = 'product';
var _search = 'pretty' -d' { "query": { "fuzzy" : { "description" : "The solar system", "fuzziness": 2 } } }';
//var _search = 'q=body:Search';
esModule.add(className, _search).then(function(result){
//dosomething() ....
},function(err){
//dosomethingElse() ....
});