Hi everyone, I am facing this weird issue and I was wondering if this was intended.
- I have 2 schemas.
BasePost which includes most common attributes for this type of document.(e.g. title, content…)
MarketPost which is a discriminator of “BasePost” which includes extra attributes.
I have search index setup with title and content.
I have post creation code with “UpdateOne” using MarketPost schema with “upsert” option.
Once I create “MarketPost” this post is not searchable until I query this post at least once. Once I query this “MarketPost”, then “MarketPost” is searchable. Let me give more verbose scenario.
- MarketPost with title: “PS4” is created (using web scrapper, so no actual user interaction)
- User search with term “PS4” but above MarketPost is not searched.
- User clicks on this “MarketPost”
- User search with term “PS4”, now this MarketPost is searched.
My theory is
Upon creating a document with “update and upsert”, document is not properly indexed.
I wonder if my theory is correct, hopefully someone here is able to answer my question.