-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[ML] Disable dynamic mapping to DFA dest index #65972
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] Disable dynamic mapping to DFA dest index #65972
Conversation
We need to disable dynamic mapping to the destination index of data frame analytics jobs. If the source index has dynamic mapping disabled, then after reindexing it is possible that we add mappings for fields that were previously unmapped, thus making them eligible features. This is confusing to the user. This commit disables dynamic mapping to the destination index. It makes all result field mappings explicit.
|
Pinging @elastic/ml-core (:ml) |
droberts195
left a comment
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, although I think there is one place where you can make the diagnostics better if a test ever fails in the future
| Map<String, Object> mergedMappingsMap = mergedMappings.getSourceAsMap(); | ||
| assertThat(mergedMappingsMap.size(), equalTo(2)); | ||
| assertThat(mergedMappingsMap.containsKey("dynamic"), is(true)); | ||
| assertThat(mergedMappingsMap.get("dynamic"), equalTo(false)); | ||
| assertThat(mergedMappingsMap.containsKey("properties"), is(true)); | ||
| assertThat(mergedMappingsMap.get("properties"), equalTo(index1Mappings.get("properties"))); |
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 you constructed a map containing the expected contents, then asserted equality with the merged mappings map then you'd get better feedback in the case of failure - both maps would get printed instead of (for example) just finding out that there were 3 items instead of 2.
przemekwitek
left a comment
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
Just two nits from my side.
| public void testGetResultMappings() { | ||
| Map<String, Object> resultMappings = new Regression("foo").getResultMappings("results", null); | ||
| assertThat(resultMappings, hasEntry("results.foo_prediction", Collections.singletonMap("type", "double"))); | ||
| assertThat(resultMappings, hasEntry("results.feature_importance", Regression.FEATURE_IMPORTANCE_MAPPING)); |
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 you also add is_training here?
| Map<String, Object> resultMappings = | ||
| new Classification("foo").getResultMappings("results", fieldCapabilitiesResponse); | ||
|
|
||
| assertThat(resultMappings, hasEntry("results.foo_prediction", singletonMap("type", "dummy"))); |
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.
[optional] An alternative which I sometimes find more readable is:
assertThat(resultMappings, allOf(hasEntry(...), ..., hasEntry(...)));
We need to disable dynamic mapping to the destination index of data frame analytics jobs. If the source index has dynamic mapping disabled, then after reindexing it is possible that we add mappings for fields that were previously unmapped, thus making them eligible features. This is confusing to the user. This commit disables dynamic mapping to the destination index. It makes all result field mappings explicit. Backport of elastic#65972
We need to disable dynamic mapping to the destination index of data frame analytics jobs. If the source index has dynamic mapping disabled, then after reindexing it is possible that we add mappings for fields that were previously unmapped, thus making them eligible features. This is confusing to the user. This commit disables dynamic mapping to the destination index. It makes all result field mappings explicit. Backport of #65972
We need to disable dynamic mapping to the destination
index of data frame analytics jobs. If the source index
has dynamic mapping disabled, then after reindexing it is
possible that we add mappings for fields that were previously
unmapped, thus making them eligible features. This is
confusing to the user.
This commit disables dynamic mapping to the destination index.
It makes all result field mappings explicit.