Elasticsearch-Simple-Api for Node
This is a Node.js module that I developed while I was working on a small WEB project with Elasticsearch and facilitated me the use of this technology.
#Functions
- addDocument (index, type, document, callback)
- addDocumentWithId (index, type, document, callback)
- addMultipleDocuments (index, type, documentsArray, callback)
- addMultipleDocumentsWithId (index, type, documentsArray, callback)
- updateDocument (index, type, id, document, callback)
- deleteDocument (index, type, id, callback)
- getDocumentById (index, type, id, callback)
- getDocumentByField (index, type, fieldName, fieldValue, callback)
- getDocumentsByName (index, name, callback)
- getDocumentsByType (index, type, callback)
- deleteIndex (index, callback)
- deleteMultipleIndexes (indexesArray, callback)
#Example
First of all, import the module:
var esa = requiere('elasticsearch-simple-api');
Call the function:
sea.addMultipleDocuments(index, type, document, function (err,result){
if (error!= undefined)
console.log('Error: ' + error);
else
console.log('OK');
});