This example from the README which sets the index dynamically does not appear to work. It always returns undefined. Am I doing something wrong? See comments...
var hapi = require('hapi');
var server = new hapi.Server();
var elasticsearch = require('es'),
config = {
_index : 'dogs',
_type : 'dog'
},
es = elasticsearch(config);
server.connection({ port: 3300, host: 'localhost' });
server.route({
method: 'GET',
path: '/',
handler: function (request, reply) {
// this works
es.count(function (err, data) {
console.log(data);
});
// setting options dynamically does not
var options = {
_index : 'cats',
_type : 'cat'
}
es.count(options, function (err, data) {
console.log(data);
});
}
});
server.start(function (err) {
if (err) {
throw err;
}
console.log('hapi server started');
});
This example from the README which sets the index dynamically does not appear to work. It always returns undefined. Am I doing something wrong? See comments...