-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[EPM] Handle object type fields with properties in mappings #64745
Conversation
Pinging @elastic/ingest-management (Team:Ingest Management) |
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.
LGTM. I'm good with merging the PR as it fixes the existing issue. Left two minor comments.
@@ -108,7 +108,15 @@ function dedupFields(fields: Fields): Fields { | |||
return f.name === field.name; | |||
}); | |||
if (found) { | |||
if (found.type === 'group' && field.type === 'group' && found.fields && field.fields) { | |||
if ( |
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.
Would be nice to have a comment in here that explains why this code is needed (to cover the a, a.b problem).
@@ -179,4 +179,35 @@ describe('processFields', () => { | |||
JSON.stringify(mixedFieldsExpanded) | |||
); | |||
}); | |||
|
|||
const objectFieldWithProperty = [ |
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.
Will it also work if you have a.b
first and then a
?
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. I've added a unit test for that.
💚 Build SucceededTo update your PR or re-run it, just comment with: |
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 checked it out and tested it. Looks good! Thanks for the quick change @skh !
…64745) * Generate correct mapping for object type field with properties * Add test for fields definition in reverse order
Summary
This fixes a problem in the mapping generation for fields of type
object
with additional properties.A field definition of
now generates a mapping of the form
Before this change, the field
a.b
did not get correctly deduped and nested under fielda
.Thanks to @jonathan-buttner for the analysis!
How to test this