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 id-values from client-manifest to suggest layers #102788

Merged
merged 14 commits into from
Jun 23, 2021

Conversation

thomasneirynck
Copy link
Contributor

@thomasneirynck thomasneirynck commented Jun 21, 2021

Summary

NOTE FOR ML-REVIEWERS: this should be a transparent change, and not require additional changes on your end. I did make simplifications under ml and data_visualizer, but no more should be needed.


The main purpose of this PR is to:

  • avoid false positives in the maps in the data-visualizer, file-upload, and anomaly-explorer. e.g. they shouldn't show a choropleth layer with states, when the underlying data is not states.
  • avoid downloading the entire GeoJson for EMS-layers in those apps. The actual geometry data is not required for the layer-suggest functionality

This uses the values-attribute from the EMS manifests, which were introduced in 7.14.

This PR removes the support for emsLayerIds. This allowed clients to explicitly check against all the fields of a layer. The downside was that the GeoJson for those layers was requested as well. This is now no longer the case.

Only joins will be suggested for fields of type id. (e.g. KY, CA, CO, NY). Fields of type name (e.g. Kentucky, California, Colorado, New York) are no longer suggested, as they are more susceptible for spelling or punctuation errors.

For maintainers

@thomasneirynck thomasneirynck marked this pull request as ready for review June 22, 2021 14:55
@thomasneirynck thomasneirynck requested a review from a team as a code owner June 22, 2021 14:55
@thomasneirynck thomasneirynck added release_note:skip Skip the PR/issue when compiling release notes v7.14.0 v8.0.0 [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation labels Jun 22, 2021
@elasticmachine
Copy link
Contributor

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

@thomasneirynck thomasneirynck requested a review from nreese June 22, 2021 16:27
interface UniqueMatch {
config: { layerId: string; field: string };
count: number;
}
interface FileLayerFieldShim {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of redefining interface, how about just importing FileLayerField from ems-client, https://github.com/elastic/ems-client/blob/master/src/ems_client.ts#L150

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, but it's not exposed as main type yet elastic/ems-client#71, will change when that is updated.

Copy link
Contributor

Choose a reason for hiding this comment

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

For the time being, can you import the type like import { FileLayerField } from '@elastic/ems-client/ems_client';?

Copy link
Contributor Author

@thomasneirynck thomasneirynck Jun 23, 2021

Choose a reason for hiding this comment

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

not quite. this is an npm dependency, and the typing dependency for the package is explicitly declared to the main file (https://github.com/elastic/ems-client/blob/master/package.json#L70). Compilation will not succeed when pointing to a "sub-module".

I'd prefer to get this addressed in ems-client first, without trying to circumvent the default import behavior.

Copy link
Contributor

@alvarezmelissa87 alvarezmelissa87 left a comment

Choose a reason for hiding this comment

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

Tested ML changes and LGTM ⚡ 🙏

@jsanz
Copy link
Member

jsanz commented Jun 23, 2021

Tested on File Upload with a CSV airports dataset that contains region and country codes and the detection worked well 👏

Peek 2021-06-23 16-16

@thomasneirynck thomasneirynck requested a review from nreese June 23, 2021 14:49
Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

is it possible to import "FileLayerField" with import { FileLayerField } from '@elastic/ems-client/ems_client';? I think it would be best to have a deep import then redefine the type.

LGTM
code review

@thomasneirynck thomasneirynck added the auto-backport Deprecated - use backport:version if exact versions are needed label Jun 23, 2021
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
ml 1699 1698 -1

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 202 201 -1

Async chunks

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

id before after diff
dataVisualizer 1.1MB 1.1MB -133.0B
maps 3.1MB 3.1MB -1.0KB
ml 5.9MB 5.9MB -139.0B
total -1.3KB
Unknown metric groups

API count

id before after diff
maps 203 202 -1

History

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

@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation release_note:skip Skip the PR/issue when compiling release notes v7.14.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants