@@ -31,6 +31,8 @@ const supportedTypes: string[] = [
3131 ES_FIELD_TYPES . SCALED_FLOAT ,
3232 ES_FIELD_TYPES . SHORT ,
3333 ES_FIELD_TYPES . IP ,
34+ ES_FIELD_TYPES . GEO_POINT ,
35+ ES_FIELD_TYPES . GEO_SHAPE ,
3436] ;
3537
3638export function fieldServiceProvider (
@@ -135,24 +137,24 @@ async function combineFieldsAndAggs(
135137 const keywordFields = getKeywordFields ( fields ) ;
136138 const numericalFields = getNumericalFields ( fields ) ;
137139 const ipFields = getIpFields ( fields ) ;
140+ const geoFields = getGeoFields ( fields ) ;
138141
139142 const isRollup = Object . keys ( rollupFields ) . length > 0 ;
140143 const mix = mixFactory ( isRollup , rollupFields ) ;
141144
142145 aggs . forEach ( a => {
143146 if ( a . type === METRIC_AGG_TYPE && a . fields !== undefined ) {
144147 switch ( a . id ) {
148+ case ML_JOB_AGGREGATION . LAT_LONG :
149+ geoFields . forEach ( f => mix ( f , a ) ) ;
150+ break ;
145151 case ML_JOB_AGGREGATION . DISTINCT_COUNT :
146152 case ML_JOB_AGGREGATION . HIGH_DISTINCT_COUNT :
147153 case ML_JOB_AGGREGATION . LOW_DISTINCT_COUNT :
148154 // distinct count (i.e. cardinality) takes keywords, ips
149155 // as well as numerical fields
150- keywordFields . forEach ( f => {
151- mix ( f , a ) ;
152- } ) ;
153- ipFields . forEach ( f => {
154- mix ( f , a ) ;
155- } ) ;
156+ keywordFields . forEach ( f => mix ( f , a ) ) ;
157+ ipFields . forEach ( f => mix ( f , a ) ) ;
156158 // note, no break to fall through to add numerical fields.
157159 default :
158160 // all other aggs take numerical fields
@@ -235,3 +237,9 @@ function getNumericalFields(fields: Field[]): Field[] {
235237 f . type === ES_FIELD_TYPES . SCALED_FLOAT
236238 ) ;
237239}
240+
241+ function getGeoFields ( fields : Field [ ] ) : Field [ ] {
242+ return fields . filter (
243+ f => f . type === ES_FIELD_TYPES . GEO_POINT || f . type === ES_FIELD_TYPES . GEO_SHAPE
244+ ) ;
245+ }
0 commit comments