【发布时间】:2017-01-24 11:40:03
【问题描述】:
我遇到了 nodejs elasticsearch 库的问题。如果我删除 console.log(hello);,下面的代码正在工作并给出结果但是如果我添加它,那么就不会出现错误。我期待未定义变量“hello”的错误消息。我需要查看错误消息以进行调试。可能是什么原因?
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);
});
【问题讨论】:
标签: node.js elasticsearch