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] Support version fields in anomaly detection wizards #132606

Merged
4 changes: 3 additions & 1 deletion x-pack/plugins/ml/common/util/fields_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ function mixFactory(isRollup: boolean, rollupFields: RollupFields) {
}

function getKeywordFields(fields: Field[]): Field[] {
return fields.filter((f) => f.type === ES_FIELD_TYPES.KEYWORD);
return fields.filter(
(f) => f.type === ES_FIELD_TYPES.KEYWORD || f.type === ES_FIELD_TYPES.VERSION
);
}

function getTextFields(fields: Field[]): Field[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ export const getDataGridSchemaFromESFieldType = (
break;
// keep schema undefined for text based columns
case ES_FIELD_TYPES.KEYWORD:
case ES_FIELD_TYPES.VERSION:
Copy link
Member Author

@jgowdyelastic jgowdyelastic May 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should have no effect, as this last collection of cases essentially behave like a default
But adding version here for completeness.

case ES_FIELD_TYPES.TEXT:
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ import {
import { ml } from '../ml_api_service';
import { processTextAndKeywordFields, NewJobCapabilitiesServiceBase } from './new_job_capabilities';

const categoryFieldTypes = [ES_FIELD_TYPES.TEXT, ES_FIELD_TYPES.KEYWORD, ES_FIELD_TYPES.IP];
const categoryFieldTypes = [
peteharverson marked this conversation as resolved.
Show resolved Hide resolved
ES_FIELD_TYPES.TEXT,
ES_FIELD_TYPES.KEYWORD,
ES_FIELD_TYPES.IP,
ES_FIELD_TYPES.VERSION,
];

class NewJobCapsService extends NewJobCapabilitiesServiceBase {
private _catFields: Field[] = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const supportedTypes: string[] = [
ES_FIELD_TYPES.GEO_POINT,
ES_FIELD_TYPES.GEO_SHAPE,
ES_FIELD_TYPES.BOOLEAN,
ES_FIELD_TYPES.VERSION,
];

export function fieldServiceProvider(
Expand Down