-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
None
-
Developer Tools
Problem
Clicking AGGREGATE from the search indexes list on an auto-embedding vectorSearch index populates the pipeline with the $vectorSearch stage template for a Bring-Your-Own-Embeddings (BYOE) index, not the auto-embedding index.
Steps to Reproduce
- Create a vectorSearch index with an autoEmbed field, e.g.:
{ "fields": [ { "type": "autoEmbed", "modality": "text", "path": "description", "model": "voyage-4" } ] }
- From the search indexes list, click AGGREGATE on this index.
Actual Result
The populated $vectorSearch stage uses the BYOE template:
{
// Name of the Atlas Vector Search index to use.
index: "vector_index",
// Indexed vectorEmbedding type field to search.
path: "<field-to-search>",
// Array of numbers that represent the query vector.
// The array size must match the number of vector dimensions specified in the index definition for the field.
queryVector: [],
// Number of nearest neighbors to use during the search.
// Value must be less than or equal to (<=) 10000.
numCandidates: 50,
limit: 10,
// Any MQL match expression that compares an indexed field with a boolean,
// number (not decimals), or string to use as a prefilter.
filter: {}
}
Expected Result
For an auto-embedding index, the populated stage should use the auto-embedding template:
{
// Name of the MongoDB Vector Search index to use.
index: "vector_index",
// Field to search.
path: "<field-to-search>",
// query: {"text": Natural Language Query string for performing semantic search}
query: {"text": query string},
limit: 10,
// Any MQL match expression that compares an indexed field with a boolean,
// number (not decimals), or string to use as a prefilter.
filter: {}
}
This proposal assumes we can show different query templates depending on whether the Aggregate button is pushed on the index that is Auto-embedding OR Bring-your-own-embeddings. If we cannot do that, proposed template is
/**
* query: {“text”: Natural Language Query string for performing semantic search} Use this option if using Automated Embedding.
* queryVector: Array of numbers of BSON types `int` or `double` that represent the query vector. The array size must match the number of vector dimensions specified in the index for the field. Use this option if you're bringing your own vectors.
* limit: Number (of type `int` only) of documents to return in the results. (Required)
* model: Specify a model, compatible with the one used during index creation, to perform embedding generation of the `query` string. If nothing is specified the same model used during index creation is used. Available only if using Automated Embedding.
*/
{
// query: {"text": query string},
// model: string,
// queryVector: [dimension1, dimension2, ...],
// Field to search.
path: "<field-to-search>",
// Name of the MongoDB Vector Search index to use.
index: "vector_index3",
limit: 10,
// Any MQL match expression that compares an indexed field with a boolean,
// number (not decimals), or string to use as a prefilter.
filter: {expression}
}
Impact
Users of auto-embedding vector indexes get a non-functional/incorrect pipeline stage prefilled when using the Aggregate entry point from the search indexes list, and must manually rewrite it to use the correct query syntax instead of queryVector.
- is related to
-
COMPASS-11157 Update $vectorSearch stage template + completion for optional numCandidates in @mongodb-js/mongodb-constants
-
- Needs Triage
-