-
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][Inference] adds new default_field_map field to trained models #53294
[ML][Inference] adds new default_field_map field to trained models #53294
Conversation
Pinging @elastic/ml-core (:ml) |
a8ecd59
to
6edfe4b
Compare
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
@@ -226,6 +235,9 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws | |||
if (licenseLevel != null) { | |||
builder.field(LICENSE_LEVEL.getPreferredName(), licenseLevel); | |||
} | |||
if (defaultFieldMappings != null) { |
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 (defaultFieldMappings != null) { | |
if (defaultFieldMappings != null && defaultFieldMappings.isEmpty() == false) { |
I prefer not to write empty collections.
randomBoolean() ? null : | ||
Stream.generate(() -> randomAlphaOfLength(10)) | ||
.limit(randomIntBetween(1, 10)) | ||
.collect(Collectors.toMap(Function.identity(), (k) -> randomAlphaOfLength(10)))); |
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.
👍 neat I never thought of building a random map this way
docs/reference/ml/ml-shared.asciidoc
Outdated
`default_field_mappings` ::: | ||
(object) | ||
A string to string mapping that contains the default field mappings to use | ||
when inferring against the model. Any field mapping described in the |
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.
Should we add a line here about multi fields which is the primary reason for this change?
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.
For sure!
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
@elasticmachine update branch |
…lastic#53294) Adds a new `default_field_map` field to trained model config objects. This allows the model creator to supply field map if it knows that there should be some map for inference to work directly against the training data. The use case internally is having analytics jobs supply a field mapping for multi-field fields. This allows us to use the model "out of the box" on data where we trained on `foo.keyword` but the `_source` only references `foo`.
…53294) (#53419) Adds a new `default_field_map` field to trained model config objects. This allows the model creator to supply field map if it knows that there should be some map for inference to work directly against the training data. The use case internally is having analytics jobs supply a field mapping for multi-field fields. This allows us to use the model "out of the box" on data where we trained on `foo.keyword` but the `_source` only references `foo`.
Adds a new
default_field_map
field to trained model config objects.This allows the model creator to supply field map if it knows that there should be some map for inference to work directly against the training data.
The use case internally is having analytics jobs supply a field mapping for multi-field fields. This allows us to use the model "out of the box" on data where we trained on
foo.keyword
but the_source
only referencesfoo
.