Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EEM] Include identity fields and values in document root #187884

Conversation

miltonhultgren
Copy link
Contributor

@miltonhultgren miltonhultgren commented Jul 9, 2024

Goal of this PR:
For a definition that sets host.name as an identity field, the history document produced should have host.name set at the root of the document to the value found.

For the latest documents, we should collect all the found values for host.name and set it to the root as well.

Maybe remove displayName from the historical documents.

Undecided how we handle the case where multiple values are found in the latest ingest pipeline.
See #187699 (comment) and #187699 (comment)

@miltonhultgren miltonhultgren added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting Feature:EEM Elastic Entity Model labels Jul 9, 2024
@obltmachine
Copy link

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@@ -144,6 +170,24 @@ export function generateHistoryProcessors(definition: EntityDefinition) {
ignore_missing: true,
},
},
{ script: { source: createIdentityFieldsPainlessScript(definition) } },
Copy link
Contributor Author

Choose a reason for hiding this comment

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

is it necessary to have this complex logic vs something more simple like

    ...definition.identityFields.map((key) => {
      return {
        set: {
          field: key.field,
          value: `{{entity.identityFields.${key.field}}}`,
          if: `ctx.entity?.identityFields?.${key.field.replaceAll('.', '?.')} != null`,
        }
      }
    }),

does this correctly handle the nested object behaviour?

Copy link
Contributor

Choose a reason for hiding this comment

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

did this get tested? i think it should work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it works! Put it back into the original PR!

@miltonhultgren miltonhultgren changed the title Eem lift identify fields to root [EEM] Include identity fields and values in document root Jul 9, 2024
@miltonhultgren
Copy link
Contributor Author

Merged this work back into #187699 since it made it easier after all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:EEM Elastic Entity Model release_note:skip Skip the PR/issue when compiling release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants