Vector Search
MongoDB Atlas Vector Search setup and query patterns.
Semantic search with MongoDB Atlas Vector Search.
Setup
When semantic search is required:
- Create an Atlas Vector Search index on the embedding field (cosine similarity is typical).
- Ensure index dimensions match the embedding model output.
- Index creation can be deferred or skipped in local dev when Atlas Search is unavailable.
- Query pattern:
$vectorSearch→$match(filters) → sort by score.
Fall back to non-vector sort (e.g. created_at) when embedding generation fails.
Storing vectors on request rows
Hosted async jobs often embed the input request at create time and store the vector on the job row. See Integration flow → Persistence.