-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Query Integration
-
Fully Compatible
-
ALL
-
v9.0
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Summary
An extension $vectorSearch inside a $lookup subpipeline that targets a view fails with Location40602 ("$_extensionVectorSearch is only valid as the first stage in a pipeline"): view resolution prepends the view's transform stages into the subpipeline, pushing the desugared $_extensionVectorSearch out of first position.
Description
When $lookup.from is a view and the subpipeline begins with an extension $vectorSearch, view resolution prepends the view's stages ahead of it. The extension stage desugars to $_extensionVectorSearch, which requires being the first stage, so the query fails:
code: 40602, codeName: "Location40602" errmsg: "$\_extensionVectorSearch is only valid as the first stage in a pipeline"
Example failing pipeline:
db..aggregate\(\[{
$lookup: {
from: "", // e.g. moviesWithEnrichedTitle
pipeline: \[{$vectorSearch: {queryVector: \[...\], path: "...", index: "...", ...}}\],
...
}
}\]\)
With the flag off, the IFR kickback retries with the legacy $vectorSearch, which handles the view prepend; with the flag on, the extension stage cannot tolerate stages ahead of it.
Environment
* Suites: with_mongot_extension_single_node.
* Flag: featureFlagExtensionsInsideHybridSearch: true.
Failing tests (currently excluded)
* jstests/with_mongot/e2e/views/vector_search/lookup_vector_search_view.js
* jstests/with_mongot/e2e/views/vector_search/lookup_subpipeline_combinations.js
* jstests/with_mongot/e2e/views/vector_search/lookup_nested_view.js
* jstests/with_mongot/e2e/views/vector_search/lookup_identity_and_combined.js
Acceptance criteria
Remove the exclusion for these four tests from buildscripts/resmokeconfig/matrix_suites/overrides/with_mongot_extension.yml (regenerate matrix suites) and they pass in the with_mongot_extension_* suites with the flag on.
- related to
-
SERVER-131470 Extension $search in a sharded $lookup with a localField/foreignField join fails with Location40602 ("$_internalDocumentResultsAndMetadata is only valid as the first stage")
-
- Closed
-