stream.on('data', function (data) { // only save tweets, not lists of friends if (data.id) { data._id = data.id; data._type = 'tweet'; console.log(data); db.post(data); es({ url: process.env.BONSAI_INDEX_URL + '/' + data._type + '/' + data._id, port: 80, method: 'POST', data: JSON.stringify(data) }, function(err, res) { console.log(err); console.log(res); }); } });
var configuration = JSON.parse( fs.readFileSync(configurationFile) ); var config = { // optional - when not supplied, defaults to the following: server : { host : 'lotus.lucy.surfsara.nl', port: 443, auth: configuration.auth, secure: true } }; es = elasticsearch(config); var options = { _index : 'lotus', _type : 'lit', refresh: false, timeout: 900000 } var c=0; var s=0; var nums=0; var docid= process.argv[2]; var timex=+ process.argv[3]; var termrichness=+ process.argv[4];
var es = require('es'); var url = require('url'); var u = url.parse(process.env.ESURL || ''); module.exports = es({ _index: (u.path && u.path.substr(1)) || 'free103', server: { auth: u.auth || '', host: u.hostname || 'localhost', port: u.port || (u.protocol === 'http:' && 80) || (u.protocol === 'https:' && 443) || 9200 } });