[ML] Fixing info content detector field selection (#51914)

* [ML] Fixing info content detector field selection

* fixing test
This commit is contained in:
James Gowdy 2019-12-02 18:51:11 +00:00 committed by GitHub
parent 51c7922518
commit 1c6bd0992c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View file

@ -397,6 +397,7 @@
"min": "min"
},
"fieldIds": [
"airline",
"responsetime"
]
},
@ -411,6 +412,7 @@
"min": "min"
},
"fieldIds": [
"airline",
"responsetime"
]
},
@ -425,6 +427,7 @@
"min": "min"
},
"fieldIds": [
"airline",
"responsetime"
]
},
@ -479,7 +482,10 @@
"aggIds": [
"distinct_count",
"high_distinct_count",
"low_distinct_count"
"low_distinct_count",
"info_content",
"high_info_content",
"low_info_content"
]
},
{

View file

@ -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);
@ -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:
@ -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);
}