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] support term joins for Elasticsearch document source with vector tile scaling #129771

Merged
merged 49 commits into from
Apr 20, 2022

Conversation

nreese
Copy link
Contributor

@nreese nreese commented Apr 7, 2022

Fixes #124227 and adds "Term join" support for "Vector tiles" scaling.

Screen Shot 2022-04-07 at 10 06 35 AM

Why vector tiles? Much faster loading. Map on left uses vector tiles with joins. Map on right uses GeoJSON with joins. Notice the loading time.
https://user-images.githubusercontent.com/373691/162276074-865fb829-baed-4725-b196-bc10c274215f.mov

Testing

  • Download world_countries_v7.geo.json from https://maps.elastic.co/#file/world_countries
  • Use geojson upload to index world_countries_v7.geo.json into elasticsearch
  • Install sample web logs data set
  • Create new map
  • Add documents layer with "world_countries" data view
  • Add term join
  • Set left field to "iso2"
  • Set right source to "kibana_sample_data_logs"
  • Set right field to "geo.dest"

Limitations

There are several limitations to term join support with vector tiles

  1. Multiple joins not supported. To deal with this limitation, term join UI disables "Add join" button, preventing users from adding more then one join. Also when switching to "Use vector tiles" scaling option, user is shown modal with message stating that multiple joins not supported and all joins but the first will be removed
    Screen Shot 2022-04-11 at 10 14 43 AM
    Screen Shot 2022-04-11 at 10 12 54 AM
  2. Style properties that use maplibre "layout" can not be styled with fields from term join. The UI has been updated to disable these fields in the field select.
    Screen Shot 2022-04-11 at 10 14 09 AM

PR updates scaling types help to better define limitations of vector tiles and when to use "Limit results"
Screen Shot 2022-04-11 at 10 51 51 AM

@nreese
Copy link
Contributor Author

nreese commented Apr 11, 2022

@elasticmachine merge upstream

@nreese nreese marked this pull request as ready for review April 13, 2022 12:40
@nreese nreese requested a review from a team as a code owner April 13, 2022 12:40
@nreese nreese added release_note:enhancement [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation v8.3.0 labels Apr 13, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-gis (Team:Geo)

@nreese nreese added the backport:skip This commit does not require backporting label Apr 13, 2022
@nreese
Copy link
Contributor Author

nreese commented Apr 14, 2022

@elasticmachine merge upstream

Copy link
Member

@nickpeihl nickpeihl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! this is a great feature. With vector tiles even a small dataset like world countries loads much faster.

code review and tested in chrome.

x-pack/plugins/maps/public/actions/layer_actions.ts Outdated Show resolved Hide resolved
@@ -343,9 +343,21 @@ export class VectorStyle implements IVectorStyle {
});

dynamicProperties.forEach((key: VECTOR_STYLES) => {
// TODO instead of looking up instance by key, update argument originalProperties to be instances instead of descriptors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we create an issue for this?

@nickpeihl
Copy link
Member

Hmm, I just noticed this error in console when switching from GeoJSON to MVT. It seems to only happen when I have multiple joins and click the "Accept" button to switch to a single join.

Uncaught (in promise) Error
    at data_request_actions.ts:182:1
    at index.js:11:1
    at dispatch (redux.js:667:1)
    at stopLoading (data_request_actions.ts:66:1)
    at MvtVectorLayer._syncSupportsFeatureEditing (vector_layer.tsx:540:1)
    at async MvtVectorLayer.syncData (mvt_vector_layer.tsx:203:1)
    at async data_request_actions.ts:126:1

@jsanz
Copy link
Member

jsanz commented Apr 20, 2022

Hmm, I just noticed this error in console when switching from GeoJSON to MVT. It seems to only happen when I have multiple joins and click the "Accept" button to switch to a single join.

Uncaught (in promise) Error
    at data_request_actions.ts:182:1
    at index.js:11:1
    at dispatch (redux.js:667:1)
    at stopLoading (data_request_actions.ts:66:1)
    at MvtVectorLayer._syncSupportsFeatureEditing (vector_layer.tsx:540:1)
    at async MvtVectorLayer.syncData (mvt_vector_layer.tsx:203:1)
    at async data_request_actions.ts:126:1

Same error also when switching between metrics

Peek 2022-04-20 16-28

Co-authored-by: Nick Peihl <nickpeihl@gmail.com>
@nreese
Copy link
Contributor Author

nreese commented Apr 20, 2022

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

merge conflict between base and head

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
maps 796 799 +3

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
maps 222 223 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
maps 2.6MB 2.6MB +3.7KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
maps 27 25 -2

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
maps 69.8KB 70.1KB +300.0B
Unknown metric groups

API count

id before after diff
maps 223 224 +1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@nreese nreese merged commit 88c8ed9 into elastic:main Apr 20, 2022
dmlemeshko pushed a commit to dmlemeshko/kibana that referenced this pull request May 5, 2022
…or tile scaling (elastic#129771)

* support join configuration

* set feature state

* pluckStyleMetaFromFeatures

* pluck style meta from joins

* refactor

* eslint

* clear feature state on update

* fit to bounds

* remove unneeded cast

* filter out features without join results

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* remove/add source if promoteId changes

* hide all features when there are no results

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* disable layout styles

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* disable add join button

* remove multiple term joins when switching to vector tiles

* update scaling type in-product help

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* update chropleth wizard to use MVT scaling

* clean up

* i18n fixes

* remove unused i18n tags

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* fix jest tests

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* tslint

* fix jest test

* add functional test

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* more jest fixes

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Update x-pack/plugins/maps/public/actions/layer_actions.ts

Co-authored-by: Nick Peihl <nickpeihl@gmail.com>

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Nick Peihl <nickpeihl@gmail.com>
kertal pushed a commit to kertal/kibana that referenced this pull request May 24, 2022
…or tile scaling (elastic#129771)

* support join configuration

* set feature state

* pluckStyleMetaFromFeatures

* pluck style meta from joins

* refactor

* eslint

* clear feature state on update

* fit to bounds

* remove unneeded cast

* filter out features without join results

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* remove/add source if promoteId changes

* hide all features when there are no results

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* disable layout styles

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* disable add join button

* remove multiple term joins when switching to vector tiles

* update scaling type in-product help

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* update chropleth wizard to use MVT scaling

* clean up

* i18n fixes

* remove unused i18n tags

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* fix jest tests

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* tslint

* fix jest test

* add functional test

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* more jest fixes

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Update x-pack/plugins/maps/public/actions/layer_actions.ts

Co-authored-by: Nick Peihl <nickpeihl@gmail.com>

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Nick Peihl <nickpeihl@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation release_note:enhancement v8.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Maps][Vector Tiles] support join operator like in the limit to 10.000 option
6 participants