Skip to content
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 unsigned_long as a numeric field supported in the anomaly detection job wizards #81351

Closed
droberts195 opened this issue Oct 21, 2020 · 1 comment
Assignees

Comments

@droberts195
Copy link
Contributor

A new field type unsigned_long was added to Elasticsearch in elastic/elasticsearch#60050 and core Kibana in #81115. This is a new type of numeric field. It seems to work fine in the ML Java code, but the ML UI wizards prevent it from being used with numeric functions (mean, min, max, etc) in ML jobs, so the ability to do this should be added. Given that this is supported in core Kibana now it could be argued that it is now a bug that it's not supported in the ML UI.

It appears that the following patch would allow this (although it would be good to add tests too and I may have missed subtle side effects):

diff --git a/x-pack/plugins/ml/server/models/job_service/new_job_caps/field_service.ts b/x-pack/plugins/ml/server/models/job_service/new_job_caps/field_service.ts
index c3b1de64c3e..fec60f221b4 100644
--- a/x-pack/plugins/ml/server/models/job_service/new_job_caps/field_service.ts
+++ b/x-pack/plugins/ml/server/models/job_service/new_job_caps/field_service.ts
@@ -27,6 +27,7 @@ const supportedTypes: string[] = [
   ES_FIELD_TYPES.INTEGER,
   ES_FIELD_TYPES.FLOAT,
   ES_FIELD_TYPES.LONG,
+  ES_FIELD_TYPES.UNSIGNED_LONG,
   ES_FIELD_TYPES.BYTE,
   ES_FIELD_TYPES.HALF_FLOAT,
   ES_FIELD_TYPES.SCALED_FLOAT,
@@ -245,6 +246,7 @@ function getNumericalFields(fields: Field[]): Field[] {
   return fields.filter(
     (f) =>
       f.type === ES_FIELD_TYPES.LONG ||
+      f.type === ES_FIELD_TYPES.UNSIGNED_LONG ||
       f.type === ES_FIELD_TYPES.INTEGER ||
       f.type === ES_FIELD_TYPES.SHORT ||
       f.type === ES_FIELD_TYPES.BYTE ||
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants