如何解决' Not Found'带有elasticsearch的expressjs中的消息

时间:2017-09-01 00:51:36

标签: node.js express elasticsearch elastic-stack bigdata

你可以告诉我如何在expressjs

解决这个错误信息
POST /test/_search 404 45.691 ms - 1235
Trace: Not Found

我刚刚在带弹性搜索的快递中尝试了这段代码

/* GET home page. */
router.get('/', function(req, res, next) {
client.search({
  index: 'test',
  body:{
    query:{
      multi_match:{
          query: 'i5',
          fields: ['title']
          }
        }
      }
 }).then(function (response) {
     var hits = response.hits.hits;
     console.log(response);
     console.log(response.hits);
     console.log(response.hits.hits);
  }, function (error) {
      console.trace(error.message);
  })
  res.render('index', { title: 'Express'});
});

请帮助解决此问题谢谢

0 个答案:

没有答案