-
Notifications
You must be signed in to change notification settings - Fork 129
Validate fields based on their mappings and the dynamic templates set #2285
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
Changes from 1 commit
2c3f76e
41d7b88
ff5298e
af04d66
f21c712
aa28db6
3767111
9fb80b4
2ad28ac
8bdad65
151e59e
d0ff6b9
b474b4b
066b5a0
a7eb191
7666ac2
a718796
0a5e775
131cc9c
38db8df
9ff3d0c
5165612
ce557c9
ebda859
019ffd4
8f36c18
d96ffbf
dbca4fe
8fce0ec
c333707
0569cfb
1aea303
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
multi_fields are now compared directly with dynamic templates or ECS fields. It was required to know whether or not that field was a multi_field or not to apply some specific validations.
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,8 @@ import ( | |
| "github.com/elastic/elastic-package/internal/packages/buildmanifest" | ||
| ) | ||
|
|
||
| const externalFieldAppendedTag = "ecs_component" | ||
|
|
||
| var ( | ||
| semver2_0_0 = semver.MustParse("2.0.0") | ||
| semver2_3_0 = semver.MustParse("2.3.0") | ||
|
|
@@ -448,7 +450,7 @@ func appendECSMappingMultifields(schema []FieldDefinition, prefix string) []Fiel | |
| { | ||
| Name: "text", | ||
| Type: "match_only_text", | ||
| External: "ecs", | ||
| External: externalFieldAppendedTag, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Workaround to be able to filter multifieds generated here during the validation.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be a better approach for this ?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have many failures if we don't do this? Maybe we can leave this for a separate change.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As talked offline, we decided to ignore the validation of these multi-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.
Does
match_patternapplies also forunmatch?According to this, maybe it just applies for
match.https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-templates.html#match-unmatch
WDYT ?
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.
Yeah, the docs seem to indicate that it only applies to
match, but it would be weird that it is not possible to set this option forunmatch. Maybematch_patternapplies to both?In any case, do we generate templates with these options?
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.
According to the tests it looks like it applies to both parameters
https://github.com/elastic/elasticsearch/blob/fe3a3cb70e3dd18b3e5ddaf6a63389b4cb16b776/server/src/test/java/org/elasticsearch/index/mapper/DynamicTemplatesTests.java#L2391-L2397
And also it looks like it could apply to
path_matchandpath_unmatch, lookign at this testhttps://github.com/elastic/elasticsearch/blob/75bf27c8b69b7c32fb200afd5a244e7b1f8aea32/x-pack/plugin/core/template-resources/src/main/resources/watch-history.json#L23
Currently, I think that
math_patternparameter is not used. Fleet does not generate that and currently the ECS component template does not use it neither.