Skip to content

Avoid exhaustive score mode in QueryPhaseCollector - #155690

Open
reugn wants to merge 3 commits into
elastic:mainfrom
reugn:query-phase-collector-score-mode
Open

Avoid exhaustive score mode in QueryPhaseCollector#155690
reugn wants to merge 3 commits into
elastic:mainfrom
reugn:query-phase-collector-score-mode

Conversation

@reugn

@reugn reugn commented Aug 2, 2026

Copy link
Copy Markdown
Member

Addresses the two TODOs in QueryPhaseCollector.scoreMode:

  • when the top docs and the aggs collector only disagree on whether they need scores, the score mode is now TOP_DOCS_WITH_SCORES instead of COMPLETE. Aggs do report these score modes, see CompositeAggregator and GlobalOrdCardinalityAggregator.
  • with min_score, TOP_DOCS now becomes TOP_DOCS_WITH_SCORES and TOP_DOCS_WITH_SCORES is left alone, instead of both becoming COMPLETE.

In both cases we get the scores we need without asking for exhaustive collection. The rest of the behaviour is unchanged: COMPLETE_NO_SCORES with min_score still becomes COMPLETE, skipping is still up to the collectors, and setMinCompetitiveScore is still ignored when aggs are collected.

Adds two tests that run real searches with real collectors, one per case.

Closes #97271

@reugn reugn added >enhancement Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch :Search Foundations/Search Catch all for Search Foundations v9.6.0 labels Aug 2, 2026
@elasticsearchmachine

Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-search-foundations (Team:Search Foundations)

@elasticsearchmachine

Copy link
Copy Markdown
Collaborator

Hi @reugn, I've created a changelog YAML for you.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🔍 Preview links for changed docs

⏳ Building and deploying preview... View progress

This comment will be updated with preview links when the build is complete.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

ℹ️ Important: Docs version tagging

👋 Thanks for updating the docs! Just a friendly reminder that our docs are now cumulative. This means all 9.x versions are documented on the same page and published off of the main branch, instead of creating separate pages for each minor version.

We use applies_to tags to mark version-specific features and changes.

Expand for a quick overview

When to use applies_to tags:

✅ At the page level to indicate which products/deployments the content applies to (mandatory)
✅ When features change state (e.g. preview, ga) in a specific version
✅ When availability differs across deployments and environments

What NOT to do:

❌ Don't remove or replace information that applies to an older version
❌ Don't add new information that applies to a specific version without an applies_to tag
❌ Don't forget that applies_to tags can be used at the page, section, and inline level

🤔 Need help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement :Search Foundations/Search Catch all for Search Foundations Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch v9.6.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve QueryPhaseCollector scoreMode implementation

2 participants