Add initial support to validate the mappings in system tests#2214
Add initial support to validate the mappings in system tests#2214mrodm merged 62 commits intoelastic:mainfrom
Conversation
|
/test |
internal/fields/validate.go
Outdated
|
|
||
| dataStreamName string | ||
|
|
||
| LocalSchema []FieldDefinition |
There was a problem hiding this comment.
New variable to hold just the Field Definitions from the local directory (package).
It is needed to check if a given mapping is related to a field definition with type array.
internal/fields/validate.go
Outdated
|
|
||
| v.Schema = append(fields, v.Schema...) | ||
|
|
||
| v.LocalSchema = fields |
There was a problem hiding this comment.
Added here for completeness, but it is not used in this validator.
Should we remove it from here?
There was a problem hiding this comment.
If not used I would say to remove it.
|
test integrations |
|
Created or updated PR in integrations repository to test this version. Check elastic/integrations#11828 |
💛 Build succeeded, but was flaky
Failed CI StepsHistory
cc @mrodm |
|
test integrations |
|
Created or updated PR in integrations repository to test this version. Check elastic/integrations#11828 |
|
Another package ( Should it be validated using dynamic templates? Error: Field definition in the package: - name: options
type: object
object_type: keyword
object_type_mapping_type: "*"
No mapping created in the preview, and this mapping is created in the actual mappings after ingesting some docs (no dynamic template present): "tines.audit_log.inputs.inputs.options": {
"type": "keyword",
"ignore_above": 1024
},cc @jsoriano |
This is weird because the generated component template makes sense. In +++ /tmp/tines-subobjects-false-global/component_templates/logs-tines.audit_logs@package.json 2024-12-11 19:53:31.500743669 +0100
@@ -7,7 +7,7 @@
"lifecycle": {
"name": "logs"
},
- "default_pipeline": "logs-tines.audit_logs-1.12.2",
+ "default_pipeline": "logs-tines.audit_logs-1.13.0",
"mapping": {
"total_fields": {
"limit": "1000"
@@ -113,8 +113,7 @@
"createFormEmptyState": {
"type": "boolean"
}
- },
- "subobjects": false
+ }
},
"eventName": {
"ignore_above": 1024,
@@ -347,7 +346,8 @@
}
}
}
- }
+ },
+ "subobjects": false
}
},
"_meta": {I can see mappings in the preview, the main difference is that when ...
"properties": {
"@timestamp": {
"type": "date",
"ignore_malformed": false
},
"data_stream.dataset": {
"type": "constant_keyword"
},
"data_stream.namespace": {
"type": "constant_keyword"
},
"data_stream.type": {
"type": "constant_keyword"
},
"event.agent_id_status": {
"type": "keyword",
"ignore_above": 1024
},
...With what version of the stack you are missing the mappings in the preview? |
|
Ah, you mean that no mapping is generated in the preview for this dynamic mapping. Yes, this looks like some issue in Fleet, it is not generating the dynamic mappings for subobjects. |
|
The problem is not related to subobjects, it can be also reproduced without setting This looks like an issue in Fleet, it could generate both mappings, the more specific static mapping for the boolean, and the dynamic template as catch all for the rest. |
jsoriano
left a comment
There was a problem hiding this comment.
I think we can go on with this change and polish things in future PRs.
Exactly, that specific field definition had no mapping nor dynamic mapping in the preview.
Thanks for checking this out! |
No dynamic mapping was being generated for tines.audit_log.inputs.inputs.options.*, and this package uses the tines.audit_log.inputs.inputs.options field directly, without having any mapping for it or its sub-properties. The workaround ensures that there is a mapping for tines.audit_log.inputs.inputs.* that serves for tines.audit_log.inputs.inputs.options as well as for its subobjects. The configured dynamic mapping was not being generated due to some issue in Fleet that we are investigating. We detected this issue while refactoring field mappings tests in elastic-package, more about this in elastic/elastic-package#2214[1]. [1]elastic/elastic-package#2214 (comment) Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co>
…ic#12082) No dynamic mapping was being generated for tines.audit_log.inputs.inputs.options.*, and this package uses the tines.audit_log.inputs.inputs.options field directly, without having any mapping for it or its sub-properties. The workaround ensures that there is a mapping for tines.audit_log.inputs.inputs.* that serves for tines.audit_log.inputs.inputs.options as well as for its subobjects. The configured dynamic mapping was not being generated due to some issue in Fleet that we are investigating. We detected this issue while refactoring field mappings tests in elastic-package, more about this in elastic/elastic-package#2214[1]. [1]elastic/elastic-package#2214 (comment) Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co>
…ic#12082) No dynamic mapping was being generated for tines.audit_log.inputs.inputs.options.*, and this package uses the tines.audit_log.inputs.inputs.options field directly, without having any mapping for it or its sub-properties. The workaround ensures that there is a mapping for tines.audit_log.inputs.inputs.* that serves for tines.audit_log.inputs.inputs.options as well as for its subobjects. The configured dynamic mapping was not being generated due to some issue in Fleet that we are investigating. We detected this issue while refactoring field mappings tests in elastic-package, more about this in elastic/elastic-package#2214[1]. [1]elastic/elastic-package#2214 (comment) Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co>
Closes #2206
Add validation of the mappings when running system tests.
This process compares the mappings installed by Fleet (preview mappings) with the ones obtained after ingesting new documents into Elasticsearch.
This validation for the time being is behind an environment variable as a technical preview:
Assumptions considered while working on this PR: #2206 (comment)
As part of this PR:
Author's checklist
prometheusfailing since some fields depend on dynamic templates (not implemented yet)ti_anomali_logsdbandauth0_logsdb