Skip to content

Resolve nested sourced_from fields into update targets on the root indexed type#1247

Merged
myronmarston merged 5 commits into
block:mainfrom
ellisandrews-toast:nested-update-target-resolver
Jun 12, 2026
Merged

Resolve nested sourced_from fields into update targets on the root indexed type#1247
myronmarston merged 5 commits into
block:mainfrom
ellisandrews-toast:nested-update-target-resolver

Conversation

@ellisandrews-toast

Copy link
Copy Markdown
Collaborator

What

ElasticGraph's sourced_from feature lets a field on one type be populated from another type's events. Until now that only worked for fields on a top-level indexed type. This PR is a step towards extending it to nested fields — fields on a type that is embedded inside an indexed type.

Concretely: when a source event arrives, ElasticGraph can now determine how to update the specific nested element it belongs to, rather than only a top-level document. This is what makes sourced_from usable for the nested data models that motivated the feature.

⚠️ This PR alone does not make the feature work ⚠️

This builds only the update-target metadata — the instructions describing which document to update, which embedded element to match, and which fields to write. Two pieces of the nested sourced_from feature are still outstanding and will land in follow-up PRs:

  • The datastore (painless) script that actually applies these instructions to the nested element at index time.
  • End-to-end acceptance tests exercising the full flow against a real datastore with a real schema.

So nested sourced_from is not yet functional after this PR; it's the schema/metadata layer that the remaining PRs build on (This PR builds on the path registration from the prior PR.)

What this PR delivers

  • The source type now gets an update target describing how to find and update the nested element when its events arrive — which document to update, which embedded element to match, and which fields to write.
  • The same validation guarantees users already rely on for top-level sourced_from (clear errors for misconfigured relationships, routing, rollover, and multi-source indexes) now apply to the nested case, with messages that point at the right place to fix.

@ellisandrews-toast ellisandrews-toast force-pushed the nested-update-target-resolver branch from d4ce494 to 0072a04 Compare June 10, 2026 21:56

@myronmarston myronmarston left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's awesome to see this coming together!

@myronmarston myronmarston left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Left a couple comments. I also have a claude session going to do a bunch of mutation testing to confirm that the current set of tests will adequately catch regressions. Once that finishes, I'll approve if it doesn't find anything significant. But I wanted to submit the 2 bits of feedback I have so far (particularly the question).

@myronmarston myronmarston left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found one coverage gap. Once that's applied this is good to merge.

@myronmarston myronmarston left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@myronmarston myronmarston enabled auto-merge (squash) June 12, 2026 00:04
@myronmarston myronmarston merged commit 7b616e8 into block:main Jun 12, 2026
19 checks passed
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