Repository navigation
fix(entity-store): write maintainer relationships as { raw_identifiers } objects - #494
Merged
Merged
Conversation
…s } objects
Entity Store v2 maps each entity.relationships.<type> (except resolution) as
an object of { raw_identifiers, ids} since elastic/kibana#262242. The
generate-entity-maintainers-data relationships maintainer still wrote bare
string arrays, so Elasticsearch rejected the documents with
document_parsing_exception on both the latest and history indices.
Emit { raw_identifiers: { user|host|service: { name: [...] } } } instead, in
the nested form Elasticsearch returns in _source so it deep-merges cleanly
with the existing entity.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
gurevichdmitry
marked this pull request as ready for review
October 20, 2026 11:31
gurevichdmitry
requested review from
chennn1990
and
a balanced review from Copilot
October 20, 2026 11:31
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Validation of latest-index and history writes against a 9.6 stack remains pending.
No open issues 🎉
What changed in this PR
Updates entity maintainer relationship data to match Entity Store v2’s object schema, addressing Elasticsearch parsing failures.
Changes:
- Wraps relationship targets in nested
raw_identifiersobjects. - Classifies targets as users, hosts, or services, with owned devices defaulting to hosts.
| File | Description |
|---|---|
| src/commands/entity_store/entity_maintainers.ts | Converts relationship arrays into typed identifier objects compatible with snapshot merging. |
Review effort: Balanced
tiansivive
reviewed
Oct 20, 2026
| // Entity Store v2 maps `entity.relationships.<type>` as an object | ||
| // ({ ids, raw_identifiers }), so bare string arrays are rejected with a | ||
| // document_parsing_exception on both the latest and history indices. | ||
| type RelationshipIdentifierKind = 'user' | 'host' | 'service'; |
Contributor
There was a problem hiding this comment.
non blocking, but we do have a 4th type called 'generic', although there's been discussion on moving away from it
Contributor
Author
There was a problem hiding this comment.
@tiansivive, thanks for the review. Checked with @uri-weisman , and it’s okay to omit generic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
generate-entity-maintainers-data(the relationships maintainer) writesentity.relationships.<type>as bare string arrays, for exampleowns: ['laptop-ab12']. Since elastic/kibana#262242 (merged 2026-04-13), Entity Store v2 maps every relationship exceptresolutionas an object of{ raw_identifiers, ids }, so Elasticsearch rejects these documents.The command still exits 0, so the failure is easy to miss. On a 9.6.0-SNAPSHOT stack with
--space default --quickit logged about 27,000 failed writes, on both the history indices (.entities.v2.history.security_default.*) and the latest index (.entities.v2.latest.default-00001):The relationship code was written in #326 (2026-03-13), when Kibana's schema still used string arrays, and hasn't changed since.
Change
generateRelationshipsFieldsnow emits{ raw_identifiers: { user | host | service: { name: [...] } } }:host, synthetic services asservice, other entity names asuser.ownstargets are devices, so they default tohost._source, which Elasticsearch returns in nested form (snapshotmerges it into the history documents).user.name,host.name,service.name) are all in Kibana'sEntityRelationship.raw_identifiersschema.idsis not populated: it holds target entity EUIDs, and this generator only has names.Test plan
tsc,eslintandprettier --checkpass.generate-entity-maintainers-data --space default --quickagainst a 9.6 stack after org-data and confirm there are nodocument_parsing_exceptionerrors and thatentity.relationships.*is populated on entities and in the history snapshots.Opened as a draft until the runtime check is done.
🤖 Generated with Claude Code