I have the following mongoose pattern:
var ReviewSchema = new Schema({ title: String, details: String, user: {type: ObjectId, ref:'User'}, }); var SubjectSchema = new Schema({ name: {type: String, required: true}, website: {type: String, index: { unique: true }}, review: {type: [ReviewSchema], es_indexed:true} });
I have another User
schema referenced by Review
.
I tried the mongoosastic plugin, but I can not find ways to index the link scheme. I want to index the username of the review. Therefore, I just used an elastic search client for this.
Each search / update / delete review I searched in the database and updated the elastic search index with the value obtained from the database. Is there a better way to do this when updating the index when updating the inline schema? Thanks
source share