Tag: elasticsearch ejs elasticsearch

NodeJS不返回Elasticsearch / Mongoosastic的结果

我试图创build一个简单的search表单来search一个模型(产品)。 这里是我使用Mongoosastic的产品模型: var ProductSchema = new Schema({ category: { type: Schema.Types.ObjectId, ref: 'Category'}, name: String, price: Number, image: String, description: String }); ProductSchema.plugin(mongoosastic, { hosts: [ 'localhost:9200' ] }); 我将ElasticSearch与Product model连接起来,如下所示: Product.createMapping(function (err, mapping) { if (err) { console.log("error creating mapping"); console.log(err); } else { console.log("Mapping created"); console.log(mapping); } }); var stream = Product.synchronize(); var […]