For users using the $search or $vectorSearch operator in aggregation pipelines for MongoDB Atlas, it must be done in the first stage of the pipeline. This is similar to how $geoNear and $collStats work, which was resolved in #2493.
See the MongoDB docs on $search here.
See the MongoDB docs on $vectorSearch here.
Relevant: #2667, #2785