npm.io
0.0.1 • Published 11 years ago

elasticsearch-simple-api

Licence
—
Version
0.0.1
Deps
2
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

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');
});

Keywords