Skip to content

Commit

Permalink
[ML] Fixing info content detector field selection (elastic#51914) (el…
Browse files Browse the repository at this point in the history
…astic#52259)

* [ML] Fixing info content detector field selection

* fixing test
  • Loading branch information
jgowdyelastic authored Dec 5, 2019
1 parent b771c50 commit 53e1438
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@
"min": "min"
},
"fieldIds": [
"airline",
"responsetime"
]
},
Expand All @@ -411,6 +412,7 @@
"min": "min"
},
"fieldIds": [
"airline",
"responsetime"
]
},
Expand All @@ -425,6 +427,7 @@
"min": "min"
},
"fieldIds": [
"airline",
"responsetime"
]
},
Expand Down Expand Up @@ -479,7 +482,10 @@
"aggIds": [
"distinct_count",
"high_distinct_count",
"low_distinct_count"
"low_distinct_count",
"info_content",
"high_info_content",
"low_info_content"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ async function combineFieldsAndAggs(
rollupFields: RollupFields
): Promise<NewJobCaps> {
const keywordFields = getKeywordFields(fields);
const textFields = getTextFields(fields);
const numericalFields = getNumericalFields(fields);
const ipFields = getIpFields(fields);
const geoFields = getGeoFields(fields);
Expand All @@ -148,6 +149,10 @@ async function combineFieldsAndAggs(
case ML_JOB_AGGREGATION.LAT_LONG:
geoFields.forEach(f => mix(f, a));
break;
case ML_JOB_AGGREGATION.INFO_CONTENT:
case ML_JOB_AGGREGATION.HIGH_INFO_CONTENT:
case ML_JOB_AGGREGATION.LOW_INFO_CONTENT:
textFields.forEach(f => mix(f, a));
case ML_JOB_AGGREGATION.DISTINCT_COUNT:
case ML_JOB_AGGREGATION.HIGH_DISTINCT_COUNT:
case ML_JOB_AGGREGATION.LOW_DISTINCT_COUNT:
Expand Down Expand Up @@ -220,6 +225,10 @@ function getKeywordFields(fields: Field[]): Field[] {
return fields.filter(f => f.type === ES_FIELD_TYPES.KEYWORD);
}

function getTextFields(fields: Field[]): Field[] {
return fields.filter(f => f.type === ES_FIELD_TYPES.TEXT);
}

function getIpFields(fields: Field[]): Field[] {
return fields.filter(f => f.type === ES_FIELD_TYPES.IP);
}
Expand Down

0 comments on commit 53e1438

Please sign in to comment.