js(function() { // Initialize the client with options elastic.configure({ hostname : 'localhost', port : 9200, index : 'myIndex', type : 'myType', id : 'docID' }); elastic.index(doc, function(err, data) { // Check err... }); });
js(function() { var elastic = require('easy-elasticsearch'); // Initialize the client with options elastic.configure({ hostname : 'localhost', port : 9200 }); // A sample document to index var doc = { field : 'data' }; elastic.index('myIndex', 'myType', 'docID', doc, function(err, data) { // Check err... }); });