-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Fleet] Support dynamic_template mappings from object field #137772
[Fleet] Support dynamic_template mappings from object field #137772
Conversation
0cfbb09
to
b658868
Compare
b658868
to
3fad1e9
Compare
@@ -0,0 +1,48 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created that file to start moving mapping generation to his own module.
Pinging @elastic/fleet (Team:Fleet) |
Makes sense, yes, keep this separated as this is something new. Thanks! |
"labels": { | ||
"properties": {} | ||
}, | ||
"*": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This static field shouldn't be here, right? This creates a mapping for a field called literally cockroachdb.status.labels.*
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you are correct, I just pushed a fix for that we do not create mappings is there only dynamic template for that path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not an area of the Fleet codebase I'm too familiar with, but I think I understand everything happening here for the most part. 🚀
x-pack/plugins/fleet/server/services/epm/elasticsearch/template/template.ts
Outdated
Show resolved
Hide resolved
@kpollich Do you think we should backport this one to 8.4? |
@nchaulet - Yes let's backport to 8.4 |
@elasticmachine merge upstream |
2a22f69
to
4589dd9
Compare
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: cc @nchaulet |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
Thanks! |
This is adding features and behavior that is not defined in the package-spec which undermines the value of working from a specification as our source of truth. Please go through the process to update package-spec so that everyone knows how to benefit from these useful changes. |
Thanks @andrewkroh for raising this up, I have created an issue to follow on this elastic/package-spec#393. |
Summary
Related to #129344
Fleet generate mappings from fields yaml provided by integrations, we were not handling field with
object
andobject_type
correctly as these fields should not result in properties mappings but in dynamic templates.That PR fix that, if a field is of type
object
and contains anobject_type
we generate a dynamic template, if the path do not contains a*
we add.*
at the end of the path.For example this fields:
Will result in the following mappings
How this was implemented in beats https://github.com/elastic/beats/blob/ea207346d651448b8917b0791b2b117b9f9b9212/libbeat/template/processor.go#L444
In a second PR, we will introduce a way to generate dynamic template just by adding a
*
in the property name.@jsoriano Does it make sense to you?
I tested this by installing all the integrations (to verify all the integrations still install) and looked a few mappings to see if they seemed correct to me.
Should we target 8.4 with that change?