0
我面临着nodejs elasticsearch库的问题。如果我删除console.log(hello),以下代码正在工作并给出结果;但是,如果我添加这个,那么就没有错误发生。我期待未定义变量“hello”的错误消息。我需要查看错误消息以进行调试。可能是什么原因?Nodejs Elasticsearch错误未显示
var elasticsearch = require('elasticsearch');
var esClient = new elasticsearch.Client({
host: 'http://mywebsite.com',
// log: 'trace'
});
body = {};
esClient.search({
index: 'test',
type: 'data',
body: body
}).then(function (resp) {
console.log(hello);
console.log(resp);
});
是的,我错过了“catch”块。谢谢 :) –