Skip to content

[8.19] [Transform] Skip checkpoint query filter when runtime_mappings are present (#142452)#143170

Merged
elasticsearchmachine merged 2 commits intoelastic:8.19from
valeriy42:backport/8.19/pr-142452
Feb 27, 2026
Merged

[8.19] [Transform] Skip checkpoint query filter when runtime_mappings are present (#142452)#143170
elasticsearchmachine merged 2 commits intoelastic:8.19from
valeriy42:backport/8.19/pr-142452

Conversation

@valeriy42
Copy link
Contributor

Backports the following commits to 8.19:

…esent (elastic#142452)

## Problem

When a transform's source query references runtime fields, `DefaultCheckpointProvider.getIndexCheckpoints` passes the query to `GetCheckpointAction.Request`, which builds a `SearchShardsRequest` for shard-level `can_match` filtering. Neither `GetCheckpointAction.Request` nor `SearchShardsRequest` supports `runtime_mappings`, so the `search_shards` API fails every time.

The graceful fallback in `TransportGetCheckpointAction` (lines 137-145) catches this failure, logs a **warning**, and falls back to unfiltered shard resolution. This means:

- A warning-level log message fires on **every checkpoint** when runtime fields + query filter are used together
- The shard-skipping optimization is lost anyway (all shards queried on failure)
- No data correctness bug, but noisy logs in production

## Approach

Apply the same pattern used for the [PIT `indexFilter` fix](elastic#142450): when `runtime_mappings` are present, pass `null` as the query to `GetCheckpointAction.Request` (skipping the shard-filtering optimization cleanly rather than failing and falling back).

This is the simplest fix because:

- Propagating `runtime_mappings` through `GetCheckpointAction.Request` -> `SearchShardsRequest` -> `TransportSearchShardsAction` would require changes to core server classes and wire serialization — a much larger, riskier change for a minor optimization
- The end result is identical (all shards are queried), just without the error/warning noise
@valeriy42 valeriy42 added :ml/Transform Transform >enhancement auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport Team:ML Meta label for the ML team labels Feb 26, 2026
@elasticsearchmachine elasticsearchmachine merged commit e2d7d84 into elastic:8.19 Feb 27, 2026
28 checks passed
@valeriy42 valeriy42 deleted the backport/8.19/pr-142452 branch February 27, 2026 09:47
neilbhavsar pushed a commit that referenced this pull request Feb 27, 2026
… are present (#142452) (#143170)

* [Transform] Skip checkpoint query filter when runtime_mappings are present (#142452)

## Problem

When a transform's source query references runtime fields, `DefaultCheckpointProvider.getIndexCheckpoints` passes the query to `GetCheckpointAction.Request`, which builds a `SearchShardsRequest` for shard-level `can_match` filtering. Neither `GetCheckpointAction.Request` nor `SearchShardsRequest` supports `runtime_mappings`, so the `search_shards` API fails every time.

The graceful fallback in `TransportGetCheckpointAction` (lines 137-145) catches this failure, logs a **warning**, and falls back to unfiltered shard resolution. This means:

- A warning-level log message fires on **every checkpoint** when runtime fields + query filter are used together
- The shard-skipping optimization is lost anyway (all shards queried on failure)
- No data correctness bug, but noisy logs in production

## Approach

Apply the same pattern used for the [PIT `indexFilter` fix](#142450): when `runtime_mappings` are present, pass `null` as the query to `GetCheckpointAction.Request` (skipping the shard-filtering optimization cleanly rather than failing and falling back).

This is the simplest fix because:

- Propagating `runtime_mappings` through `GetCheckpointAction.Request` -> `SearchShardsRequest` -> `TransportSearchShardsAction` would require changes to core server classes and wire serialization — a much larger, riskier change for a minor optimization
- The end result is identical (all shards are queried), just without the error/warning noise

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

Labels

auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport >enhancement :ml/Transform Transform Team:ML Meta label for the ML team v8.19.13

2 participants