-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
[ML] Update ML mappings upgrade test and extend to config index #61340
[ML] Update ML mappings upgrade test and extend to config index #61340
Conversation
The ML mappings upgrade test had become useless as it was checking a field that has been the same since 6.5. This commit switches to a field that was changed in 7.9. Additionally, the test only used to check the results index mappings. This commit also adds checking for the config index. Relates elastic#61157
Pinging @elastic/ml-core (:ml) |
@@ -105,8 +120,40 @@ private void assertUpgradedMappings() throws Exception { | |||
assertNotNull(propertiesLevel); | |||
// TODO: as the years go by, the field we assert on here should be changed | |||
// to the most recent field we've added that is NOT of type "keyword" | |||
Map<String, Object> fieldLevel = (Map<String, Object>) propertiesLevel.get("multi_bucket_impact"); | |||
assertEquals(Collections.singletonMap("type", "double"), fieldLevel); | |||
Map<String, Object> objectLevel = (Map<String, Object>) propertiesLevel.get("model_size_stats"); |
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.
Could using XContentMapValues::extractValue
method make this more concise?
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, good point. I switched over to that.
|
||
Map<String, Object> responseLevel = entityAsMap(response); | ||
assertNotNull(responseLevel); | ||
Map<String, Object> indexLevel = (Map<String, Object>) responseLevel.get(".ml-config"); |
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.
The same here, could XContentMapValues::extractValue
be used instead of this sequence of get
s and casts?
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
The ML mappings upgrade test had become useless as it was checking a field that has been the same since 6.5. This commit switches to a field that was changed in 7.9. Additionally, the test only used to check the results index mappings. This commit also adds checking for the config index. Backport of elastic#61340
The ML mappings upgrade test had become useless as it was checking a field that has been the same since 6.5. This commit switches to a field that was changed in 7.9. Additionally, the test only used to check the results index mappings. This commit also adds checking for the config index. Backport of elastic#61340
The ML mappings upgrade test had become useless as it was checking a field that has been the same since 6.5. This commit switches to a field that was changed in 7.9. Additionally, the test only used to check the results index mappings. This commit also adds checking for the config index. Backport of #61340
The ML mappings upgrade test had become useless as it was checking a field that has been the same since 6.5. This commit switches to a field that was changed in 7.9. Additionally, the test only used to check the results index mappings. This commit also adds checking for the config index. Backport of #61340
The ML mappings upgrade test had become useless as it was
checking a field that has been the same since 6.5. This
commit switches to a field that was changed in 7.9.
Additionally, the test only used to check the results index
mappings. This commit also adds checking for the config
index.
Relates #61157