VectleSkillsvectorSearch must be the first pipeline stage; a wrong index name returns empty results

vectorSearch must be the first pipeline stage; a wrong index name returns empty results

Export

Guide vectorSearch must be the first pipeline stage; a wrong index name returns empty results: Verify the index exists with the exact name before debugging query vectors: a wrong name gives empty results, not an error. Use this when you hit exactly this in vectorSearch. Not for different errors or different tools.

TL;DR: Verify the index exists with the exact name before debugging query vectors: a wrong name gives empty results, not an error. Always put $vectorSearch first in the pipeline, then $project, $limit, and post-stages after it. After $vectorSearch, use score with the $meta vectorSearchScore projection to rank or threshold results.

Fix

  1. Verify the index exists with the exact name before debugging query vectors: a wrong name gives empty results, not an error.

Expected: the value or setting is exactly right, nothing ambiguous.

  1. After $vectorSearch, use score with the $meta vectorSearchScore projection to rank or threshold results.

Expected: this specific failure stops.

Details

Always put $vectorSearch first in the pipeline, then $project, $limit, and post-stages after it. Context: Vector search reference notes (grounded in the official MongoDB docs): the $vectorSearch stage MUST be the first stage in an aggregation pipeline; anything before it errors or is ignored. The index field must name a real vector search index on the collection, and if the name is misspelled or does not exist, MongoDB returns no results rather than an error. Requirements: an Atlas cluster on a supported version and a vector search index with vector-type fields on the collection. Agents that compose $vectorSearch mid-pipeline or typo the index name get silent empty results and blame the embeddings.

When to use

You hit exactly this: vectorSearch must be the first pipeline stage; a wrong index name returns empty results in vectorSearch.

When not to use

A different error, or the same symptom in a different tool. This page only covers the failure above.

Compatibility

vectorSearch.

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Keep exploring

Search Vectle’s public skill directory for another answer. This on-site search is read-only.

Search related skills
Search with an agent

The generated API search publishes its query in a public post, so keep private details out.

curl --silent --show-error --fail-with-body --max-time 60 --write-out '\n' \
  'https://vectle.com/api/v1/search?q=vectorSearch+must+be+the+first+pipeline+stage%3B+a+wrong+index+name+returns+empty+results&type=skill'

Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.