-
Notifications
You must be signed in to change notification settings - Fork 25k
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] Add runtime mappings to data frame analytics source config #69183
[ML] Add runtime mappings to data frame analytics source config #69183
Conversation
Users can now specify runtime mappings as part of the source config of a data frame analytics job. Those runtime mappings become part of the mapping of the destination index. This ensures the fields are accessible in the destination index even if the relevant data frame analytics job gets deleted. Closes elastic#65056
Pinging @elastic/ml-core (Team:ML) |
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.
I think it would be good to add a test for regression, classification that utilizes runtime field mappings (didn't see one). This way we can be sure it works there and works fine during the inference phase of analytics.
import java.util.Map; | ||
|
||
public final class RuntimeMappingsValidator { | ||
|
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.
private ctor?
private RuntimeMappingsValidator() { } | |
Map<String, Object> propNode = new HashMap<>(((Map<String, Object>) entry.getValue())); | ||
Object typeNode = propNode.get("type"); | ||
if (typeNode == null) { | ||
throw ExceptionsHelper.badRequestException("No type specified for runtime field [" + fieldName + "]"); |
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.
throw ExceptionsHelper.badRequestException("No type specified for runtime field [" + fieldName + "]"); | |
throw ExceptionsHelper.badRequestException("No type specified for runtime field [{}]", fieldName); |
throw ExceptionsHelper.badRequestException("Expected map for runtime field [" + fieldName + "] " + | ||
"definition but got a " + fieldName.getClass().getSimpleName()); |
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.
throw ExceptionsHelper.badRequestException("Expected map for runtime field [" + fieldName + "] " + | |
"definition but got a " + fieldName.getClass().getSimpleName()); | |
throw ExceptionsHelper.badRequestException( | |
"Expected map for runtime field [{}] definition but got a {}", | |
fieldName, | |
fieldName.getClass().getSimpleName() | |
); |
I think string formatting like this is much nicer. Feel free to ignore :)
@benwtrent Thank you for pointing out lack of coverage for regression/classification. Adding tests revealed a couple more places where I had to add runtime mappings. Pushed the fix, should be good for another review now. |
@elasticmachine update branch |
Until #69183 is backported to 7.x
#69284) Users can now specify runtime mappings as part of the source config of a data frame analytics job. Those runtime mappings become part of the mapping of the destination index. This ensures the fields are accessible in the destination index even if the relevant data frame analytics job gets deleted. Closes #65056 Backport of #69183
... after backporting #69183
…ily (#69329) Since config runtime mappings were added to data frame analytics jobs in #69183, when we create the destination index we add a `runtime` section in its mappings regardless of whether the job config contains any runtime fields. This causes failures in the BWC tests when in a mixed cluster where there are nodes versioned before runtime fields were introduced. This is the first part of the fix were we do not create a `runtime` section in the destination index mappings unless necessary.
…essarily (elastic#69329) Since config runtime mappings were added to data frame analytics jobs in elastic#69183, when we create the destination index we add a `runtime` section in its mappings regardless of whether the job config contains any runtime fields. This causes failures in the BWC tests when in a mixed cluster where there are nodes versioned before runtime fields were introduced. This is the first part of the fix were we do not create a `runtime` section in the destination index mappings unless necessary. Backport of elastic#69329
…essarily (#69329) (#69332) Since config runtime mappings were added to data frame analytics jobs in #69183, when we create the destination index we add a `runtime` section in its mappings regardless of whether the job config contains any runtime fields. This causes failures in the BWC tests when in a mixed cluster where there are nodes versioned before runtime fields were introduced. This is the first part of the fix were we do not create a `runtime` section in the destination index mappings unless necessary. Backport of #69329
Users can now specify runtime mappings as part of the source config
of a data frame analytics job. Those runtime mappings become part of
the mapping of the destination index. This ensures the fields are
accessible in the destination index even if the relevant data frame
analytics job gets deleted.
Closes #65056