Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Maps] Use ES mvt #114553

Merged
merged 114 commits into from
Oct 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
1fbc4a7
tmp
thomasneirynck Jul 13, 2021
6c339e1
Merge branch 'master' of github.com:elastic/kibana into maps/es_mvt_poc
thomasneirynck Jul 15, 2021
33bce67
tmp
thomasneirynck Jul 19, 2021
9da4dde
tmp
thomasneirynck Jul 21, 2021
d052824
Merge branch 'master' of github.com:elastic/kibana into maps/es_mvt_poc
thomasneirynck Jul 22, 2021
04c8264
tmp
thomasneirynck Aug 9, 2021
0b923cf
Merge branch 'master' of github.com:elastic/kibana into maps/es_mvt_poc
thomasneirynck Aug 28, 2021
254595c
tmp
thomasneirynck Aug 30, 2021
d2d5448
Merge branch 'master' of github.com:elastic/kibana into maps/es_mvt_poc
thomasneirynck Aug 30, 2021
4fdf57d
use es naming
thomasneirynck Aug 31, 2021
0ec6b77
typo
thomasneirynck Aug 31, 2021
f8d202c
organize files for clarity
thomasneirynck Aug 31, 2021
a4d969e
plugin for hits
thomasneirynck Aug 31, 2021
6762ec7
tmp
thomasneirynck Aug 31, 2021
ad1b192
initial styling
thomasneirynck Aug 31, 2021
f8c9e67
more boilerplate
thomasneirynck Aug 31, 2021
fb69717
tmp
thomasneirynck Aug 31, 2021
d20bd79
temp
thomasneirynck Aug 31, 2021
c831c38
add size support
thomasneirynck Aug 31, 2021
c9e0fb7
Merge branch 'master' of github.com:elastic/kibana into maps/es_mvt_poc
thomasneirynck Sep 1, 2021
832529d
remove junk
thomasneirynck Sep 2, 2021
453b32f
tooltip
thomasneirynck Sep 2, 2021
1396751
edits
thomasneirynck Sep 2, 2021
d16fbf0
too many features
thomasneirynck Sep 2, 2021
94c88a0
rename for clarity
thomasneirynck Sep 2, 2021
dea461f
typing
thomasneirynck Sep 2, 2021
72936ae
tooltip improvements
thomasneirynck Sep 3, 2021
bd4ad7d
icon
thomasneirynck Sep 3, 2021
a765eb7
callouts
thomasneirynck Sep 3, 2021
dfe86d5
align count handling
thomasneirynck Sep 3, 2021
d1e76dc
typechecks
thomasneirynck Sep 3, 2021
893b514
i18n
thomasneirynck Sep 3, 2021
3954c1c
tmp
thomasneirynck Sep 6, 2021
3422f85
Merge branch 'master' of github.com:elastic/kibana into maps/es_mvt_poc
thomasneirynck Sep 6, 2021
45a2105
type fixes
thomasneirynck Sep 6, 2021
4123e09
linting
thomasneirynck Sep 6, 2021
f9795d0
convert to ts and disable option
thomasneirynck Sep 7, 2021
d0d5cd9
readd test dependencies
thomasneirynck Sep 7, 2021
6fddc4b
typescheck
thomasneirynck Sep 7, 2021
31f148b
Merge branch 'maps/es_mvt_poc' of github.com:thomasneirynck/kibana in…
thomasneirynck Oct 5, 2021
cd32dba
update yarn lock
thomasneirynck Oct 5, 2021
9c492a4
Merge branch 'master' of github.com:elastic/kibana into maps/use_es_mvt
thomasneirynck Oct 6, 2021
d0dd638
fix typecheck
thomasneirynck Oct 6, 2021
417c4de
update snapshot
thomasneirynck Oct 6, 2021
7edda6e
fix snapshot
thomasneirynck Oct 6, 2021
2180514
fix snapshot
thomasneirynck Oct 6, 2021
1a2b603
fix snapshot
thomasneirynck Oct 6, 2021
48119dc
fix snapshot
thomasneirynck Oct 6, 2021
4082b6c
fix test
thomasneirynck Oct 6, 2021
d9c3b4d
fix tests
thomasneirynck Oct 6, 2021
8ba5a2d
fix test
thomasneirynck Oct 6, 2021
c70f51a
add key
thomasneirynck Oct 6, 2021
d8f6b3c
fix integration test
thomasneirynck Oct 6, 2021
0449eed
move test
thomasneirynck Oct 6, 2021
5f1f1f5
use centroid placement
thomasneirynck Oct 6, 2021
d39b3f0
more text fixes
thomasneirynck Oct 7, 2021
a760dc9
more test fixes
thomasneirynck Oct 7, 2021
ab965eb
Merge branch 'master' of github.com:elastic/kibana into maps/use_es_mvt
thomasneirynck Oct 7, 2021
8a589fa
Merge branch 'master' of github.com:elastic/kibana into maps/use_es_mvt
thomasneirynck Oct 7, 2021
f516cce
Merge branch 'master' of github.com:elastic/kibana into maps/use_es_mvt
thomasneirynck Oct 7, 2021
03b81eb
Merge branch 'master' of github.com:elastic/kibana into maps/use_es_mvt
thomasneirynck Oct 7, 2021
5715aa5
Merge branch 'master' of github.com:elastic/kibana into maps/use_es_mvt
thomasneirynck Oct 11, 2021
0521890
Remove top terms aggregations when switching to super fine resolution…
nreese Oct 12, 2021
1b2e028
merge with master
nreese Oct 12, 2021
93c9205
mvt labels
nreese Oct 12, 2021
45306d4
remove isPointsOnly from IVectorSource interface
nreese Oct 12, 2021
3aba351
merge with master
nreese Oct 13, 2021
82b67fd
move get_centroid_featues to vector_layer since its no longer used in…
nreese Oct 13, 2021
ec69301
labels
nreese Oct 13, 2021
ba2f599
warn users when selecting scaling type that does not support term joins
nreese Oct 13, 2021
0761876
clean up scaling_form
nreese Oct 13, 2021
8aef4fe
Merge branch 'master' of github.com:elastic/kibana into feature/maps/…
nreese Oct 14, 2021
1237826
remove IField.isCountable method
nreese Oct 14, 2021
84d0788
move pluck code from common to dynamic_style_property
nreese Oct 14, 2021
8da04d4
move convert_to_geojson to es_geo_grid_source folder
nreese Oct 14, 2021
a8da0ae
Merge branch 'master' into feature/maps/use_es_mvt
kibanamachine Oct 18, 2021
cbf3255
remove getMbFeatureIdPropertyName from IVectorLayer
nreese Oct 18, 2021
3bb1abb
clean up cleanTooltipStateForLayer
nreese Oct 18, 2021
7a61358
Merge branch 'master' into feature/maps/use_es_mvt
kibanamachine Oct 19, 2021
2f78af9
use euiWarningColor for too many features outline
nreese Oct 19, 2021
4df35bf
update jest snapshots and eslint fixes
nreese Oct 20, 2021
7f0ac13
update docs for incomplete data changes
nreese Oct 20, 2021
12b9cea
move tooManyFeatures MB layer definition from VectorLayer to TiledVec…
nreese Oct 20, 2021
0acd312
remove commented out filter in tooltip_control add api docs for getMb…
nreese Oct 20, 2021
eda0b67
revert changing getSourceTooltipContent to getSourceTooltipConfigFrom…
nreese Oct 20, 2021
48c87be
replace DEFAULT_MAX_RESULT_WINDOW with loading maxResultWindow as dat…
nreese Oct 20, 2021
ad560a5
clean up
nreese Oct 20, 2021
34be69c
eslint
nreese Oct 20, 2021
bbc2653
remove unused constants from Kibana MVT implemenation and tooManyFeat…
nreese Oct 20, 2021
207a2a2
add better should method for tiled_vector_layer.getCustomIconAndToolt…
nreese Oct 20, 2021
65efb3a
fix tooltips not being displayed for super-fine clusters and grids
nreese Oct 20, 2021
e1e2c6e
Merge branch 'master' into feature/maps/use_es_mvt
kibanamachine Oct 20, 2021
eeeeac8
fix check in getFeatureId for es_Search_sources only
nreese Oct 20, 2021
d6b69bd
eslint, remove __kbn_metadata_feature__ filter from mapbox style expects
nreese Oct 20, 2021
8bc0bba
remove geoFieldType paramter for tile API
nreese Oct 21, 2021
5a29c57
remove searchSessionId from MVT url since its no longer used
nreese Oct 21, 2021
52a7f4c
tslint
nreese Oct 21, 2021
2e0cbad
vector tile scaling option copy update
nreese Oct 21, 2021
efbf9b5
fix getTile and getGridTile API integration tests
nreese Oct 21, 2021
01bef07
remove size from _mvt request body, size provided in query
nreese Oct 21, 2021
28bae1d
eslint, fix test expect
nreese Oct 21, 2021
55de7e1
merge with master
nreese Oct 21, 2021
cb3592c
stablize jest test
nreese Oct 21, 2021
0b4a93c
track total hits for _mvt request
nreese Oct 21, 2021
958ced5
track total hits take 2
nreese Oct 21, 2021
bb1448b
align vector tile copy
nreese Oct 21, 2021
df6964e
eslint
nreese Oct 22, 2021
a383be1
revert change to EsSearchSource._loadTooltipProperties with regards t…
nreese Oct 22, 2021
e003e97
clean up
nreese Oct 22, 2021
0e4e68a
only send metric aggregations to mvt/getGridTile endpoint
nreese Oct 22, 2021
01ecad3
update snapshot, update getGridTile URLs in tests
nreese Oct 22, 2021
2909005
update request URL for getGridTile
nreese Oct 22, 2021
0dc5411
eslint
nreese Oct 22, 2021
ddb5d29
Merge branch 'master' into feature/maps/use_es_mvt
kibanamachine Oct 25, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/maps/vector-layer.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ Results exceeding `index.max_result_window` are not displayed.

* *Show clusters when results exceed 10,000* When results exceed `index.max_result_window`, the layer uses {ref}/search-aggregations-bucket-geotilegrid-aggregation.html[GeoTile grid aggregation] to group your documents into clusters and displays metrics for each cluster. When results are less then `index.max_result_window`, the layer displays features from individual documents.

* *Use vector tiles.* Vector tiles partition your map into 6 to 8 tiles.
* *Use vector tiles.* Vector tiles partition your map into tiles.
Each tile request is limited to the `index.max_result_window` index setting.
Tiles exceeding `index.max_result_window` have a visual indicator when there are too many features to display.
When a tile exceeds `index.max_result_window`, results exceeding `index.max_result_window` are not contained in the tile and a dashed rectangle outlining the bounding box containing all geo values within the tile is displayed.

*EMS Boundaries*:: Administrative boundaries from https://www.elastic.co/elastic-maps-service[Elastic Maps Service].

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@
"@mapbox/geojson-rewind": "^0.5.0",
"@mapbox/mapbox-gl-draw": "1.3.0",
"@mapbox/mapbox-gl-rtl-text": "0.2.3",
"@mapbox/vector-tile": "1.3.1",
"@reduxjs/toolkit": "^1.6.1",
"@slack/webhook": "^5.0.4",
"@turf/along": "6.0.1",
Expand Down Expand Up @@ -460,6 +459,7 @@
"@kbn/test": "link:bazel-bin/packages/kbn-test",
"@kbn/test-subj-selector": "link:bazel-bin/packages/kbn-test-subj-selector",
"@loaders.gl/polyfills": "^2.3.5",
"@mapbox/vector-tile": "1.3.1",
"@microsoft/api-documenter": "7.7.2",
"@microsoft/api-extractor": "7.7.0",
"@octokit/rest": "^16.35.0",
Expand Down
10 changes: 1 addition & 9 deletions x-pack/plugins/maps/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,7 @@ export const CHECK_IS_DRAWING_INDEX = `/${GIS_API_PATH}/checkIsDrawingIndex`;

export const MVT_GETTILE_API_PATH = 'mvt/getTile';
export const MVT_GETGRIDTILE_API_PATH = 'mvt/getGridTile';
export const MVT_SOURCE_LAYER_NAME = 'source_layer';
// Identifies vector tile "too many features" feature.
// "too many features" feature is a box showing area that contains too many features for single ES search response
export const KBN_METADATA_FEATURE = '__kbn_metadata_feature__';
export const KBN_FEATURE_COUNT = '__kbn_feature_count__';
export const KBN_IS_TILE_COMPLETE = '__kbn_is_tile_complete__';
export const KBN_VECTOR_SHAPE_TYPE_COUNTS = '__kbn_vector_shape_type_counts__';
export const KBN_TOO_MANY_FEATURES_IMAGE_ID = '__kbn_too_many_features_image_id__';

// Identifies centroid feature.
// Centroids are a single point for representing lines, multiLines, polygons, and multiPolygons
export const KBN_IS_CENTROID_FEATURE = '__kbn_is_centroid_feature__';
Expand Down Expand Up @@ -119,7 +112,6 @@ export const DEFAULT_MAX_RESULT_WINDOW = 10000;
export const DEFAULT_MAX_INNER_RESULT_WINDOW = 100;
export const DEFAULT_MAX_BUCKETS_LIMIT = 65535;

export const FEATURE_ID_PROPERTY_NAME = '__kbn__feature_id__';
export const FEATURE_VISIBLE_PROPERTY_NAME = '__kbn_isvisibleduetojoin__';

export const MB_SOURCE_ID_LAYER_ID_PREFIX_DELIMITER = '_';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,13 @@
import { Query } from 'src/plugins/data/public';
import { Feature } from 'geojson';
import {
FieldMeta,
HeatmapStyleDescriptor,
StyleDescriptor,
VectorStyleDescriptor,
} from './style_property_descriptor_types';
import { DataRequestDescriptor } from './data_request_descriptor_types';
import { AbstractSourceDescriptor, TermJoinSourceDescriptor } from './source_descriptor_types';
import { VectorShapeTypeCounts } from '../get_geometry_counts';
import {
KBN_FEATURE_COUNT,
KBN_IS_TILE_COMPLETE,
KBN_METADATA_FEATURE,
KBN_VECTOR_SHAPE_TYPE_COUNTS,
LAYER_TYPE,
} from '../constants';
import { LAYER_TYPE } from '../constants';

export type Attribution = {
label: string;
Expand All @@ -38,11 +30,8 @@ export type JoinDescriptor = {

export type TileMetaFeature = Feature & {
properties: {
[KBN_METADATA_FEATURE]: true;
[KBN_IS_TILE_COMPLETE]: boolean;
[KBN_FEATURE_COUNT]: number;
[KBN_VECTOR_SHAPE_TYPE_COUNTS]: VectorShapeTypeCounts;
fieldMeta?: FieldMeta;
'hits.total.relation': string;
'hits.total.value': number;
};
};

Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/maps/common/elasticsearch_util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

export * from './es_agg_utils';
export * from './convert_to_geojson';
export * from './elasticsearch_geo_utils';
export * from './spatial_filter_utils';
export * from './types';
Expand Down
45 changes: 0 additions & 45 deletions x-pack/plugins/maps/common/get_geometry_counts.ts

This file was deleted.

46 changes: 0 additions & 46 deletions x-pack/plugins/maps/common/pluck_category_field_meta.ts

This file was deleted.

34 changes: 0 additions & 34 deletions x-pack/plugins/maps/common/pluck_range_field_meta.ts

This file was deleted.

21 changes: 16 additions & 5 deletions x-pack/plugins/maps/public/actions/data_request_actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,10 @@ function endDataLoad(

if (dataId === SOURCE_DATA_REQUEST_ID) {
const features = data && 'features' in data ? (data as FeatureCollection).features : [];
const layer = getLayerById(layerId, getState());

const eventHandlers = getEventHandlers(getState());
if (eventHandlers && eventHandlers.onDataLoadEnd) {
const layer = getLayerById(layerId, getState());
const resultMeta: ResultMeta = {};
if (layer && layer.getType() === LAYER_TYPE.VECTOR) {
const featuresWithoutCentroids = features.filter((feature) => {
Expand All @@ -301,7 +301,9 @@ function endDataLoad(
});
}

dispatch(updateTooltipStateForLayer(layerId, features));
if (layer) {
dispatch(updateTooltipStateForLayer(layer, features));
}
}

dispatch({
Expand Down Expand Up @@ -344,7 +346,10 @@ function onDataLoadError(
});
}

dispatch(updateTooltipStateForLayer(layerId));
const layer = getLayerById(layerId, getState());
if (layer) {
dispatch(updateTooltipStateForLayer(layer));
}
}

dispatch({
Expand All @@ -359,7 +364,10 @@ function onDataLoadError(
}

export function updateSourceDataRequest(layerId: string, newData: object) {
return (dispatch: ThunkDispatch<MapStoreState, void, AnyAction>) => {
return (
dispatch: ThunkDispatch<MapStoreState, void, AnyAction>,
getState: () => MapStoreState
) => {
dispatch({
type: UPDATE_SOURCE_DATA_REQUEST,
dataId: SOURCE_DATA_REQUEST_ID,
Expand All @@ -368,7 +376,10 @@ export function updateSourceDataRequest(layerId: string, newData: object) {
});

if ('features' in newData) {
dispatch(updateTooltipStateForLayer(layerId, (newData as FeatureCollection).features));
const layer = getLayerById(layerId, getState());
if (layer) {
dispatch(updateTooltipStateForLayer(layer, (newData as FeatureCollection).features));
}
}

dispatch(updateStyleMeta(layerId));
Expand Down
32 changes: 27 additions & 5 deletions x-pack/plugins/maps/public/actions/layer_actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import {
} from '../../common/descriptor_types';
import { ILayer } from '../classes/layers/layer';
import { IVectorLayer } from '../classes/layers/vector_layer';
import { OnSourceChangeArgs } from '../classes/sources/source';
import { DRAW_MODE, LAYER_STYLE_TYPE, LAYER_TYPE } from '../../common/constants';
import { IVectorStyle } from '../classes/styles/vector/vector_style';
import { notifyLicensedFeatureUsage } from '../licensed_features';
Expand Down Expand Up @@ -217,7 +218,7 @@ export function setLayerVisibility(layerId: string, makeVisible: boolean) {
}

if (!makeVisible) {
dispatch(updateTooltipStateForLayer(layerId));
dispatch(updateTooltipStateForLayer(layer));
}

dispatch({
Expand Down Expand Up @@ -323,18 +324,17 @@ function updateMetricsProp(layerId: string, value: unknown) {
) => {
const layer = getLayerById(layerId, getState());
const previousFields = await (layer as IVectorLayer).getFields();
await dispatch({
dispatch({
type: UPDATE_SOURCE_PROP,
layerId,
propName: 'metrics',
value,
});
await dispatch(updateStyleProperties(layerId, previousFields as IESAggField[]));
dispatch(syncDataForLayerId(layerId, false));
};
}

export function updateSourceProp(
function updateSourcePropWithoutSync(
layerId: string,
propName: string,
value: unknown,
Expand All @@ -356,6 +356,28 @@ export function updateSourceProp(
if (newLayerType) {
dispatch(updateLayerType(layerId, newLayerType));
}
};
}

export function updateSourceProp(
layerId: string,
propName: string,
value: unknown,
newLayerType?: LAYER_TYPE
) {
return async (dispatch: ThunkDispatch<MapStoreState, void, AnyAction>) => {
await dispatch(updateSourcePropWithoutSync(layerId, propName, value, newLayerType));
dispatch(syncDataForLayerId(layerId, false));
};
}

export function updateSourceProps(layerId: string, sourcePropChanges: OnSourceChangeArgs[]) {
return async (dispatch: ThunkDispatch<MapStoreState, void, AnyAction>) => {
// Using for loop to ensure update completes before starting next update
for (let i = 0; i < sourcePropChanges.length; i++) {
const { propName, value, newLayerType } = sourcePropChanges[i];
await dispatch(updateSourcePropWithoutSync(layerId, propName, value, newLayerType));
}
dispatch(syncDataForLayerId(layerId, false));
};
}
Expand Down Expand Up @@ -504,7 +526,7 @@ function removeLayerFromLayerList(layerId: string) {
layerGettingRemoved.getInFlightRequestTokens().forEach((requestToken) => {
dispatch(cancelRequest(requestToken));
});
dispatch(updateTooltipStateForLayer(layerId));
dispatch(updateTooltipStateForLayer(layerGettingRemoved));
layerGettingRemoved.destroy();
dispatch({
type: REMOVE_LAYER,
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/maps/public/actions/map_actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import { INITIAL_LOCATION } from '../../common/constants';
import { updateTooltipStateForLayer } from './tooltip_actions';
import { VectorLayer } from '../classes/layers/vector_layer';
import { SET_DRAW_MODE } from './ui_actions';
import { expandToTileBoundaries } from '../../common/geo_tile_utils';
import { expandToTileBoundaries } from '../classes/util/geo_tile_utils';
import { getToasts } from '../kibana_services';

export function setMapInitError(errorMessage: string) {
Expand Down Expand Up @@ -171,7 +171,7 @@ export function mapExtentChanged(mapExtentState: MapExtentState) {
if (prevZoom !== nextZoom) {
getLayerList(getState()).map((layer) => {
if (!layer.showAtZoomLevel(nextZoom)) {
dispatch(updateTooltipStateForLayer(layer.getId()));
dispatch(updateTooltipStateForLayer(layer));
}
});
}
Expand Down
Loading