-
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
[Fleet] Add support for additional types for dynamic mappings #168842
[Fleet] Add support for additional types for dynamic mappings #168842
Conversation
Pinging @elastic/fleet (Team:Fleet) |
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
Add support for fields that generate and dynamic mapping of the following types: - scaled_float - half_float - match_only_text - aggregate_metric_double - ip - integer (mapped as long as in other cases) - group (child fields are installed as dynamic mappings) When the type is not known, an error is raised now instead of silently ignoring the field definition.
6069a3e
to
0855613
Compare
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.
Code + tests look good. Thanks for contributing this!
…into scaled-float-dynamic-mapping
…-ref HEAD~1..HEAD --fix'
dynProperties.time_series_metric = field.metric_type; | ||
matchingType = field.object_type_mapping_type ?? 'long'; | ||
break; | ||
case 'integer': |
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.
Should it be added unsigned_long
too ?
It is also an allowed object_type
according to package-spec:
https://github.com/elastic/package-spec/blob/a4b0a7ff139c9b85e44602caeb83d93716c1f4d8/spec/integration/data_stream/fields/fields.spec.yml#L488
@@ -258,27 +256,73 @@ function _generateMappings( | |||
dynProperties = histogram(field); | |||
matchingType = field.object_type_mapping_type ?? '*'; | |||
break; | |||
case 'ip': |
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.
There are some types that are not specified in the object_type
field definition in package-spec: ip, wildcard, group or match_only_text
Should these be added too here?
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]
History
To update your PR or re-run it, just comment with: cc @jsoriano |
…c#168842) Add support for fields that generate dynamic mappings of the following types: - match_only_text - scaled_float - aggregate_metric_double - half_float - ip - flattened - integer (mapped as long as in other cases) - group (child fields are installed as dynamic mappings) Default `match_matching_type` has been corrected to provide always a valid value. For example for floats it was using `float`, what is invalid, for this case it is changed to `double`. When the type is not known, an error is raised now instead of silently ignoring the field definition, this helps package developers discover earlier if their mappings are not well supported. Tested with the `install_all_packages` and no current package fails because of this. Fix elastic#168823
) For `dynamic: "runtime"`, and possibly other configurations different to `dynamic: true`, intermediate objects need to exist for dynamic mappings, otherwise ingestion can fail with `Missing intermediate object` errors. This pull request includes these intermediate objects, and avoids the creation of static properties with wildcards, that is probably not what is expected for these mappings. Intermediate objects are included as static properties for parts of the name before the wildcard, and as dynamic templates when the full path has wildcards. In the modified test files are examples of all of these. This is more an issue since the following recent fixes, that create the actual dynamic mappings for some cases where only empty objects were created before. * elastic/elastic-package#1492 * #168842
Summary
Add support for fields that generate dynamic mappings of the following types:
Default
match_matching_type
has been corrected to provide always a valid value. Forexample for floats it was using
float
, what is invalid, for this case it is changed todouble
.When the type is not known, an error is raised now instead of silently ignoring the field definition,
this helps package developers discover earlier if their mappings are not well supported.
Tested with the
install_all_packages
and no current package fails because of this.Fix #168823
Checklist
Delete any items that are not applicable to this PR.
Risk Matrix
When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:
install_all_packages
script, and no current package fails because of this. Most cases catched earlier on Package Spec validation.