-
Notifications
You must be signed in to change notification settings - Fork 116
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
Add initial support to validate the mappings in system tests #2214
base: main
Are you sure you want to change the base?
Conversation
/test |
internal/fields/validate.go
Outdated
|
||
dataStreamName string | ||
|
||
LocalSchema []FieldDefinition |
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.
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
.
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.
Why not using Schema
?
internal/fields/validate.go
Outdated
@@ -295,6 +328,8 @@ func createValidatorForDirectoryAndPackageRoot(fieldsParentDir string, finder pa | |||
} | |||
|
|||
v.Schema = append(fields, v.Schema...) | |||
|
|||
v.LocalSchema = fields |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If not used I would say to remove it.
if !found { | ||
return nil, errors.New("package root not found and dependency management is enabled") | ||
} | ||
fdm, v.Schema, err = initDependencyManagement(packageRoot, v.specVersion, v.enabledImportAllECSSchema) |
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.
v.Schema
holds the Field Definitions from ECS
v.LocalSchema
holds the Field Definitions found in the package (local directory).
Make use of the External value in the ECS fields loaded into the schema to be able to distinguish which fields come from ECS and which ones come from the fields directory from the package. This allows to perform different tests when validating mappings
test integrations |
Created or updated PR in integrations repository to test this version. Check elastic/integrations#11828 |
Looking at the integrations PR testing with the new validation mappings (not all packages tested, there were some filtered for now):
cc @jsoriano |
This failure has been skipped, as for packages with spec < 3.0.1 it was not checked when using the fields validation and elastic-package/internal/fields/validate.go Line 1200 in 8cc126a
|
This field was an empty object (but inside another that neither was present in the preview): "process": {
"properties": {
"parent": {
"type": "object"
}
}
} Maybe as a result of the ingest pipeline? As Added the skip logic for this scenario here: cdf7821 |
test integrations |
Created or updated PR in integrations repository to test this version. Check elastic/integrations#11828 |
There is a difference in the
{
"ecs_date": {
"path_match": [
"*.timestamp",
"*_timestamp",
"*.not_after",
"*.not_before",
"*.accessed",
"created",
"*.created",
"*.installed",
"*.creation_date",
"*.ctime",
"*.mtime",
"ingested",
"*.ingested",
"*.start",
"*.end"
],
"unmatch_mapping_type": "object",
"mapping": {
"type": "date"
}
}
},
{
"ecs_date": {
"path_match": [
"*.timestamp",
"*_timestamp",
"*.not_after",
"*.not_before",
"*.accessed",
"created",
"*.created",
"*.installed",
"*.creation_date",
"*.ctime",
"*.mtime",
"ingested",
"*.ingested",
"*.start",
"*.end",
"*.indicator.first_seen",
"*.indicator.last_seen",
"*.indicator.modified_at",
"*threat.enrichments.matched.occurred"
],
"unmatch_mapping_type": "object",
"mapping": {
"type": "date"
}
}
} Not sure if it could be applied some kind of exception @jsoriano |
💚 Build Succeeded
History
cc @mrodm |
For the
{
"_embedded_ecs-url_original_to_multifield": {
"path_match": "*.url.original",
"mapping": {
"fields": {
"text": {
"type": "match_only_text"
}
},
"type": "wildcard"
}
}
},
{
"ecs_path_match_wildcard_and_match_only_text": {
"path_match": [
"*.body.content",
"*url.full",
"*url.original"
],
"unmatch_mapping_type": "object",
"mapping": {
"fields": {
"text": {
"type": "match_only_text"
}
},
"type": "wildcard"
}
}
}, |
In the second build from integrations, In the first build, this package was not failing: |
The error related to This package fails with both 8.14.0 and 8.15.3 stack versions. Mapping created for this field in this package during tests: "process": {
"properties": {
"pid": {
"type": "float"
},
"title": {
"type": "keyword",
"fields": {
"text": {
"type": "match_only_text"
}
}
}
}
} EDIT: It looks like that currently (with fields validation), this is accepted if the definition is long (ECS) and the value has type float: elastic-package/internal/fields/validate.go Lines 1234 to 1247 in 8cc126a
|
Triggered a new execution in integrations with the rest of packages: |
In the latest integrations build, there are some failures in network_traffic package. These look related to the same issue #2214 (comment) There are fields undefined under a
EDIT: Not sure how to detect this via the actual or preview mappings |
Relates #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
prometheus
failing since some fields depend on dynamic templates (not implemented yet)ti_anomali_logsdb
andauth0_logsdb