mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
* [ML] Enabling lat_long agg in advanced wizard * fixing tests
This commit is contained in:
parent
76662c1669
commit
f24be43b68
2 changed files with 16 additions and 11 deletions
|
@ -460,9 +460,7 @@
|
|||
"max": "max",
|
||||
"min": "min"
|
||||
},
|
||||
"fieldIds": [
|
||||
"responsetime"
|
||||
]
|
||||
"fieldIds": []
|
||||
}
|
||||
],
|
||||
"fields": [
|
||||
|
@ -513,8 +511,7 @@
|
|||
"low_non_null_sum",
|
||||
"info_content",
|
||||
"high_info_content",
|
||||
"low_info_content",
|
||||
"lat_long"
|
||||
"low_info_content"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
@ -31,6 +31,8 @@ const supportedTypes: string[] = [
|
|||
ES_FIELD_TYPES.SCALED_FLOAT,
|
||||
ES_FIELD_TYPES.SHORT,
|
||||
ES_FIELD_TYPES.IP,
|
||||
ES_FIELD_TYPES.GEO_POINT,
|
||||
ES_FIELD_TYPES.GEO_SHAPE,
|
||||
];
|
||||
|
||||
export function fieldServiceProvider(
|
||||
|
@ -135,6 +137,7 @@ async function combineFieldsAndAggs(
|
|||
const keywordFields = getKeywordFields(fields);
|
||||
const numericalFields = getNumericalFields(fields);
|
||||
const ipFields = getIpFields(fields);
|
||||
const geoFields = getGeoFields(fields);
|
||||
|
||||
const isRollup = Object.keys(rollupFields).length > 0;
|
||||
const mix = mixFactory(isRollup, rollupFields);
|
||||
|
@ -142,17 +145,16 @@ async function combineFieldsAndAggs(
|
|||
aggs.forEach(a => {
|
||||
if (a.type === METRIC_AGG_TYPE && a.fields !== undefined) {
|
||||
switch (a.id) {
|
||||
case ML_JOB_AGGREGATION.LAT_LONG:
|
||||
geoFields.forEach(f => mix(f, a));
|
||||
break;
|
||||
case ML_JOB_AGGREGATION.DISTINCT_COUNT:
|
||||
case ML_JOB_AGGREGATION.HIGH_DISTINCT_COUNT:
|
||||
case ML_JOB_AGGREGATION.LOW_DISTINCT_COUNT:
|
||||
// distinct count (i.e. cardinality) takes keywords, ips
|
||||
// as well as numerical fields
|
||||
keywordFields.forEach(f => {
|
||||
mix(f, a);
|
||||
});
|
||||
ipFields.forEach(f => {
|
||||
mix(f, a);
|
||||
});
|
||||
keywordFields.forEach(f => mix(f, a));
|
||||
ipFields.forEach(f => mix(f, a));
|
||||
// note, no break to fall through to add numerical fields.
|
||||
default:
|
||||
// all other aggs take numerical fields
|
||||
|
@ -235,3 +237,9 @@ function getNumericalFields(fields: Field[]): Field[] {
|
|||
f.type === ES_FIELD_TYPES.SCALED_FLOAT
|
||||
);
|
||||
}
|
||||
|
||||
function getGeoFields(fields: Field[]): Field[] {
|
||||
return fields.filter(
|
||||
f => f.type === ES_FIELD_TYPES.GEO_POINT || f.type === ES_FIELD_TYPES.GEO_SHAPE
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue