File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
x-pack/plugins/maps/public
classes/sources/es_source Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -587,8 +587,8 @@ export function fitToDataBounds() {
587587 const b = bounds [ i ] ;
588588
589589 //filter out undefined bounds (uses Infinity due to turf responses)
590-
591590 if (
591+ b === null ||
592592 b . minLon === Infinity ||
593593 b . maxLon === Infinity ||
594594 b . minLat === - Infinity ||
Original file line number Diff line number Diff line change @@ -161,16 +161,15 @@ export class AbstractESSource extends AbstractVectorSource {
161161 let esBounds ;
162162 try {
163163 const esResp = await searchSource . fetch ( ) ;
164- esBounds = _ . get ( esResp , 'aggregations.fitToBounds.bounds' ) ;
164+ if ( ! esResp . aggregations . fitToBounds . bounds ) {
165+ // aggregations.fitToBounds is empty object when there are no matching documents
166+ return null ;
167+ }
168+ esBounds = esResp . aggregations . fitToBounds . bounds ;
165169 } catch ( error ) {
166170 return null ;
167171 }
168172
169- // aggregations.fitToBounds is empty object when there are no matching documents
170- if ( ! esBounds ) {
171- return null ;
172- }
173-
174173 const minLon = esBounds . top_left . lon ;
175174 const maxLon = esBounds . bottom_right . lon ;
176175 return {
You can’t perform that action at this time.
0 commit comments