Skip to content

Write _source filtering of bulk update actions as a source filter object - #4208

Merged
Philippus merged 1 commit into
Philippus:series/9.xfrom
EDALJO:fix/bulk-update-source-filtering
Nov 10, 2026
Merged

Philippus merged 1 commit into
Philippus:series/9.xfrom
EDALJO:fix/bulk-update-source-filtering

Conversation

@EDALJO

@EDALJO EDALJO commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

A bulk update with fetchSource(includes, excludes) fails the whole bulk request with unknown parameter [_source_includes].

Design

  • Write a _source object on the action line: _source_includes/_source_excludes are update API URL parameters, not bulk metadata.
  • Reuse FetchSourceContextBuilderFn: search and inner hits already serialize source filtering through it.
  • fetchSource(true) and fetchSource(false) are unchanged: only filtered requests produce different output.

Notes for reviewers

  • Checked on Elasticsearch 7.17, 8.19, 9.5 and OpenSearch 1.3, 2.19, 3.5: old form fails, new form works everywhere.
  • series/8.x has the same builder code: should this be backported there too?

The bulk action line wrote includes and excludes as _source_includes and
_source_excludes, which are URL parameters of the update API, so
Elasticsearch and OpenSearch rejected the whole bulk request. Write them
as a _source object with includes and excludes instead, as the search
and multi get builders already do.
@EDALJO
EDALJO marked this pull request as ready for review November 9, 2026 22:20
@Philippus
Philippus merged commit 545f510 into Philippus:series/9.x Nov 10, 2026
3 checks passed
@Philippus

Copy link
Copy Markdown
Owner

thanks, nice catch!

@EDALJO

EDALJO commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

Cheers — thanks for the swift merge!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants