我是Nodejs的新手,我正在使用nodejs和socket.io处理聊天应用程序,我需要使用nodejs向Elasticsearch发送客户聊天消息。
我已将elasticsearch与使用以下代码相关联,
var elasticsearch = require('elasticsearch');
var client = new elasticsearch.Client({
host: 'localhost:9200',
log: 'trace',
connectionClass:'http'
});
client.ping({
// ping usually has a 3000ms timeout
requestTimeout: Infinity,
// undocumented params are appended to the query string
hello: "elasticsearch!"
}, function (error) {
if (error) {
console.trace('elasticsearch cluster is down!');
} else {
console.log('All is well');
}
});
我不知道在哪里设置配置,将客户消息发送到elasticsearch。建议我怎么做?