sails:如何将excel数据存储到node.js中的elasticserach中

时间:2015-09-01 11:02:48

标签: javascript json node.js elasticsearch sails.js

我正在使用文件上传功能,并以json格式重写excel文件。我需要将此json文件存储到弹性搜索中。我可以将该excel数据存储到elasticsearch中。

任何人都可以帮助我吗?

提前致谢。

var elasticsearch = require('elasticsearch');
var client = new elasticsearch.Client({
    host: 'localhost:9200',
    log: 'trace'
});
client.create({
    index: 'myindex',
    type: 'mytype',
    id:2,
    body: workbook.Strings,
},function (error) {
    if (error) 
    {
        console.log('elasticsearch cluster is down!');
    } 
    else 
    {
        console.log('All is well');
    }
});

但我收到elasticsearch cluster is down! Elasticsearch TRACE: 2015-09-01T12:14:59Z错误。请帮我解决此问题。

0 个答案:

没有答案
相关问题