Skip to content

Expand fetch phase profiling to support queries that utilize multiple shards #18863

@andrevandeven

Description

@andrevandeven

Is your feature request related to a problem? Please describe

This issue is part of a larger meta issue to add fetch phase information to the search profile.

I am currently implementing fetch phase profiling: Add Fetch Phase to Search Profile #18664 .

Profiling will first be implemented for the single-shard case. When there is only one shard, the search executes the fetch phase immediately after the query phase and the profile is rebuilt right away.

Focusing on the single-shard case first allows for isolated development and validation of the core fetch profiling logic before tackling the more complex distributed coordination required for multi-shard searches.

When the search involves multiple shards, executeQueryPhase returns only the query-phase results. The coordinating node later sends a ShardFetchRequest for each shard, which runs executeFetchPhase(ShardFetchRequest ...). This method performs the fetch but does not rebuild or attach new profiling information.

Describe the solution you'd like

Return QueryFetchSearchResult (containing the updated QuerySearchResult with rebuilt profile data) instead of only FetchSearchResult when profiling is enabled, even in multi‑shard fetch requests.

Related component

Search:Query Insights

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    ✅ Done

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions