栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

为什么Monososastic填充/elasticsearch未填充我的参考文献之一?我有一个空物体

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

为什么Monososastic填充/elasticsearch未填充我的参考文献之一?我有一个空物体

我已经工作了,但是它与npm / github上给出的示例有很大不同。

我必须删除es_schema:样式(就像我偶然为品牌所做的那样,这就是它起作用的原因)。我必须添加es_type:“ nested” /
es_include_in_parent,该文件是我从elasticsearch和mongoosastic文档中收集的。

我不确定这是故意的,但它似乎可以工作:

style: {type: mongoose.Schema.Types.ObjectId, ref: 'Style',    es_type:'nested', es_include_in_parent:true},

现在,当我console.log results.hits时,得到:style:[Object]根据需要。


以下是npm中给出的示例,它对我不起作用:

var Comment = new Schema({    title: String  , body: String  , author: String});var User = new Schema({    name: {type:String, es_indexed:true}  , email: String  , city: String  , comments: {type: Schema.Types.ObjectId, ref: 'Comment',    es_schema: Comment, es_indexed:true, es_select: 'title body'}})User.plugin(mongoosastic, {  populate: [    {path: 'comments', select: 'title body'}  ]})


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/403694.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号