Skip to content

Commit

Permalink
Merge branch 'master' into 58669-multiple-alert-expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Feb 27, 2020
2 parents 5293fe4 + dc2dcd8 commit 876ef56
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 23 deletions.
1 change: 0 additions & 1 deletion x-pack/legacy/plugins/maps/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import 'uiExports/inspectorViews';
import 'uiExports/search';
import 'uiExports/embeddableFactories';
import 'uiExports/embeddableActions';
import 'ui/agg_types';

import 'ui/autoload/all';
import 'react-vis/dist/style.css';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
import { InnerJoin } from './inner_join';

jest.mock('../../kibana_services', () => {});
jest.mock('ui/agg_types', () => {
class MockSchemas {}
return {
Schemas: MockSchemas,
};
});
jest.mock('ui/timefilter', () => {});
jest.mock('../vector_layer', () => {});

Expand Down
22 changes: 6 additions & 16 deletions x-pack/legacy/plugins/maps/public/layers/sources/es_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
import { createExtentFilter } from '../../elasticsearch_geo_utils';
import { timefilter } from 'ui/timefilter';
import _ from 'lodash';
import { AggConfigs } from 'ui/agg_types';
import { i18n } from '@kbn/i18n';
import uuid from 'uuid/v4';
import { copyPersistentState } from '../../reducers/util';
Expand Down Expand Up @@ -151,27 +150,18 @@ export class AbstractESSource extends AbstractVectorSource {
{ sourceQuery, query, timeFilters, filters, applyGlobalQuery },
0
);
const geoField = await this._getGeoField();
const indexPattern = await this.getIndexPattern();

const geoBoundsAgg = [
{
type: 'geo_bounds',
enabled: true,
params: {
field: geoField,
searchSource.setField('aggs', {
fitToBounds: {
geo_bounds: {
field: this._descriptor.geoField,
},
schema: 'metric',
},
];

const aggConfigs = new AggConfigs(indexPattern, geoBoundsAgg);
searchSource.setField('aggs', aggConfigs.toDsl());
});

let esBounds;
try {
const esResp = await searchSource.fetch();
esBounds = _.get(esResp, 'aggregations.1.bounds');
esBounds = _.get(esResp, 'aggregations.fitToBounds.bounds');
} catch (error) {
esBounds = {
top_left: {
Expand Down

0 comments on commit 876ef56

Please sign in to comment.