diff --git a/x-pack/plugins/maps/public/classes/sources/es_search_source/create_source_editor.js b/x-pack/plugins/maps/public/classes/sources/es_search_source/create_source_editor.js index e23c9813a11b5e..adedde2761f2ec 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_search_source/create_source_editor.js +++ b/x-pack/plugins/maps/public/classes/sources/es_search_source/create_source_editor.js @@ -65,7 +65,9 @@ export class CreateSourceEditor extends Component { _onIndexPatternSelect = (indexPatternId) => { this.setState({ indexPatternId }, () => { - this._previewLayer(); + if (!indexPatternId) { + this._previewLayer(); + } this._loadIndexPattern(indexPatternId); }); }; @@ -110,7 +112,7 @@ export class CreateSourceEditor extends Component { geoFields, }); - if (geoFields.length && !this.state.geoFieldName) { + if (geoFields.length) { // make default selection, prefer aggregatable field over the first available const firstAggregatableGeoField = geoFields.find((geoField) => { return geoField.aggregatable;