Skip to content

Commit

Permalink
[ML] Removing counter fields from wizards (#153639)
Browse files Browse the repository at this point in the history
Further improvements to the anomaly detection and data frame analysts
wizards to ensure counter fields cannot be selected when configuring a
new job.
Adds a `counter` flag to the `new_job_caps` response which is used to
remove counter fields from dropdowns in the DFA and advanced AD wizards.

The outlier detection wizard still has an issue caused by the call to
the `_explain` endpoint. This needs to be fixed in elasticsearch
elastic/elasticsearch#94691
  • Loading branch information
jgowdyelastic authored Apr 3, 2023
1 parent a18627d commit 662507b
Show file tree
Hide file tree
Showing 11 changed files with 717 additions and 619 deletions.
4 changes: 3 additions & 1 deletion x-pack/plugins/ml/common/types/fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export interface Field {
id: FieldId;
name: string;
type: ES_FIELD_TYPES;
aggregatable?: boolean;
aggregatable: boolean;
counter: boolean;
aggIds?: AggId[];
aggs?: Aggregation[];
runtimeField?: estypes.MappingRuntimeField;
Expand Down Expand Up @@ -95,6 +96,7 @@ export const mlCategory: Field = {
name: MLCATEGORY,
type: ES_FIELD_TYPES.KEYWORD,
aggregatable: false,
counter: false,
};

export type RollupFields = Record<FieldId, [Record<'agg', ES_AGGREGATION>]>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@ export class JobCreator {
name: id,
type: Array.isArray(runtimeField) ? runtimeField[0].type : runtimeField.type,
aggregatable: true,
counter: false,
aggs: [],
runtimeField,
} as Field)
Expand All @@ -793,6 +794,7 @@ export class JobCreator {
name: f,
type: ES_FIELD_TYPES.KEYWORD,
aggregatable: true,
counter: false,
}));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ export function collectAggs(o: any, aggFields: Field[]) {
name: k,
type: ES_FIELD_TYPES.KEYWORD,
aggregatable: true,
counter: false,
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,13 +627,15 @@
"name": "@timestamp",
"type": "date",
"aggregatable": true,
"counter": false,
"aggIds": []
},
{
"id": "CPUUtilization",
"name": "CPUUtilization",
"type": "double",
"aggregatable": true,
"counter": false,
"aggIds": [
"mean",
"high_mean",
Expand Down Expand Up @@ -667,6 +669,7 @@
"name": "DiskReadBytes",
"type": "double",
"aggregatable": true,
"counter": false,
"aggIds": [
"mean",
"high_mean",
Expand Down Expand Up @@ -700,6 +703,7 @@
"name": "DiskReadOps",
"type": "double",
"aggregatable": true,
"counter": false,
"aggIds": [
"mean",
"high_mean",
Expand Down Expand Up @@ -733,6 +737,7 @@
"name": "DiskWriteBytes",
"type": "double",
"aggregatable": true,
"counter": false,
"aggIds": [
"mean",
"high_mean",
Expand Down Expand Up @@ -766,6 +771,7 @@
"name": "DiskWriteOps",
"type": "double",
"aggregatable": true,
"counter": false,
"aggIds": [
"mean",
"high_mean",
Expand Down Expand Up @@ -799,6 +805,7 @@
"name": "instance",
"type": "keyword",
"aggregatable": true,
"counter": false,
"aggIds": [
"distinct_count",
"high_distinct_count",
Expand All @@ -810,6 +817,7 @@
"name": "NetworkIn",
"type": "double",
"aggregatable": true,
"counter": false,
"aggIds": [
"mean",
"high_mean",
Expand Down Expand Up @@ -843,6 +851,7 @@
"name": "NetworkOut",
"type": "double",
"aggregatable": true,
"counter": false,
"aggIds": [
"mean",
"high_mean",
Expand Down Expand Up @@ -876,6 +885,7 @@
"name": "region",
"type": "keyword",
"aggregatable": true,
"counter": false,
"aggIds": [
"distinct_count",
"high_distinct_count",
Expand All @@ -887,13 +897,15 @@
"name": "sourcetype",
"type": "text",
"aggregatable": false,
"counter": false,
"aggIds": []
},
{
"id": "sourcetype.keyword",
"name": "sourcetype.keyword",
"type": "keyword",
"aggregatable": true,
"counter": false,
"aggIds": [
"distinct_count",
"high_distinct_count",
Expand Down
Loading

0 comments on commit 662507b

Please sign in to comment.