Node.js Mongoostic插件不';不更新嵌套对象
因此,该项目包括下一个堆栈NodeJS、Express、Mongodb和ElasticSearch。对于弹性搜索的索引,我们使用Mongoostic插件 我有以下模型,它们之间有1:M关系,每当我更新组时,我也希望在用户对象中更新组。 因此,如果我更新组,它只会在ElasticSearch中的组索引中更新,而不会在用户索引中更新。但是如果我随后再次更新用户,组对象将正确实现。 它应该是es_类型的,并且es_包含在父对象中,但这两种方式都不起作用Node.js Mongoostic插件不';不更新嵌套对象,node.js,mongodb,elasticsearch,mongoose,mongoosastic,Node.js,Mongodb,elasticsearch,Mongoose,Mongoosastic,因此,该项目包括下一个堆栈NodeJS、Express、Mongodb和ElasticSearch。对于弹性搜索的索引,我们使用Mongoostic插件 我有以下模型,它们之间有1:M关系,每当我更新组时,我也希望在用户对象中更新组。 因此,如果我更新组,它只会在ElasticSearch中的组索引中更新,而不会在用户索引中更新。但是如果我随后再次更新用户,组对象将正确实现。 它应该是es_类型的,并且es_包含在父对象中,但这两种方式都不起作用 const UserSchema: mongoo
const UserSchema: mongoose.Schema = new mongoose.Schema({
email: String,
password: String,
group: {
type: mongoose.Schema.Types.ObjectId,
ref: 'groups',
es_indexed: true,
es_type: 'nested',
es_include_in_parent: true
}
}, { timestamps: true } as SchemaOptions);
UserSchema.plugin(mongoosastic, {..elasticSearchConfig,
index: 'users',
populate: [
{path: 'group', model: 'groups'}
]}
);
export const UserModel = mongoose.model('users', UserSchema, 'users');
及
提前谢谢 添加参数
es_schema
例如,应该解决您的问题
es_schema:User.schema
es_schema:User.schema