const elasticsearch = require('elasticsearch');
// instantiate an Elasticsearch client
const client = new elasticsearch.Client({
  hosts: [ 'http://******:9200']
})
client.search({
          index: 'recommender', //elasticSearch的索引
          type: 'Movie',  //索引储存的数据类型
          body: {
            query: {
              match: {
                name: query //匹配的字段
              }
            }
          }
        }).then(function (resp) {
          var hits = resp.hits.hits; //返回的响应数据
          console.log(hits)
          
        }, function (err) {
          console.trace(err.message);
        });

Logo

前往低代码交流专区

更多推荐