From 588808e98285ca4e6d6988ec014f1196f95ab252 Mon Sep 17 00:00:00 2001 From: Khelan Modi Date: Tue, 26 May 2026 14:31:12 -0700 Subject: [PATCH] Fix cosmosSearch vector field name: query -> vector The cosmosSearch operator in Azure DocumentDB's $search aggregation stage takes the query embedding under the ector field, not query. The previous examples would fail at runtime (or silently return wrong results depending on server version), and the agent surfaces these files verbatim when generating vector-search code. Fixes three occurrences: - skills/vector-search/vector-knn-query.md (both the incorrect and correct examples) - skills/full-text-search/fts-hybrid-search.md (vector arm of the hybrid example) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- skills/full-text-search/fts-hybrid-search.md | 2 +- skills/vector-search/vector-knn-query.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/skills/full-text-search/fts-hybrid-search.md b/skills/full-text-search/fts-hybrid-search.md index bcad938..8d215a6 100644 --- a/skills/full-text-search/fts-hybrid-search.md +++ b/skills/full-text-search/fts-hybrid-search.md @@ -68,7 +68,7 @@ const kwHits = await db.products.aggregate([ // Vector arm const qv = await embed(userQuery); const vecHits = await db.products.aggregate([ - { $search: { cosmosSearch: { path: "embedding", query: qv, k: 50 } } }, + { $search: { cosmosSearch: { path: "embedding", vector: qv, k: 50 } } }, { $project: { _id: 1, vec: { $meta: "searchScore" } } } ]).toArray(); diff --git a/skills/vector-search/vector-knn-query.md b/skills/vector-search/vector-knn-query.md index a5b2d1e..a7171fa 100644 --- a/skills/vector-search/vector-knn-query.md +++ b/skills/vector-search/vector-knn-query.md @@ -20,7 +20,7 @@ Or post-filtering that drops 90% of your top-k before the user sees anything: ```javascript db.products.aggregate([ - { $search: { cosmosSearch: { path: "embedding", query: qv, k: 10 } } }, + { $search: { cosmosSearch: { path: "embedding", vector: qv, k: 10 } } }, { $match: { inStock: true, price: { $lte: 100 } } } // may leave 1-2 results ]); ``` @@ -37,7 +37,7 @@ const hits = await db.products.aggregate([ $search: { cosmosSearch: { path: "embedding", - query: queryVector, + vector: queryVector, k: 10, lSearch: 100, // higher than k, boosts recall filter: {