Mohammad Shahid Mohammad Shahid - 1 year ago 86
Node.js Question

Nodejs Elasticsearch errors are not showing

I am facing problem with nodejs elasticsearch library. Below code is working and giving result if I remove console.log(hello); But if I add this then no error is coming. I am expecting error message of undefined variable "hello". I need to see error message for debugging purpose. What could be the reason?

var elasticsearch = require('elasticsearch');
var esClient = new elasticsearch.Client({
host: '',
// log: 'trace'

body = {};{
index: 'test',
type: 'data',
body: body
}).then(function (resp) {


Answer Source

Are you sure that the code reaches inside the then function ? maybe search is throwing a error and you have no catch block ???

try :{...})
        .then(function (resp) {


see if you getting any error then ?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download