elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.69k stars 8.12k forks source link

[Maps] Add spatial filter from cluster #128211

Closed thomasneirynck closed 2 years ago

thomasneirynck commented 2 years ago

Describe the feature:

Cluster features should have a little "create filter" button in them, similar to how individual docs can create filters from field-values.

This way, users can create dashboards where they can select a cluster, and see details of the contents of a cluster.

Describe a specific use case for the feature:

Dashboard with a map and a saved-search. Selecting a cluster in the map on the left should open a tooltip with a "filter on cluster" button. This creates a spatial filter, which will filter down the saved-search on the right with the contents of the cluster.

image

elasticmachine commented 2 years ago

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

nreese commented 2 years ago

"Filter by geometry" exists when clusters are rendered with geojson. "Filter by geometry" does not exist when clusters are rendered by vector tiles.

The reason "Filter by geometry" does not exist for vector tiles is that the application has no access to the original geometry and can only get geometry from the tile. This means that the geometry may have been simplified or incomplete if it crosses tile boundaries. Simplification is not really a problem for simple geometries created by aggregations but was a large problem for complex geometries. For hexagons, buckets that cross tile boundaries may be a problem. Maybe we could just turn on "Filter by geometry" for aggregation features when rendered by vector tiles. Thoughts?

Screen Shot 2022-03-21 at 3 00 54 PM
thomasneirynck commented 2 years ago

For hexagons, buckets that cross tile boundaries may be a problem

imho, I don't think this is all that big of an issue. Yes, zoomed-out this is a problem, but negligible when zoomed in.

Maybe we could just turn on "Filter by geometry" for aggregation features when rendered by vector tiles.

Yes, I didn't realize we didn't have this for vector tiles only. Makes sense. I think just turning it on would be great.

Rather than saying, "filter by geometry", maybe it should say something like "Filter by cluster".

What I had more in mind here, is that is Maps is not necessarily filtering by the underlying geometry from the tile-contents (which gets difficult with hexes, since they cross tiles). But that Maps can reconstruct the geometry based on the key, and construct a good spatial-filter from that. Or even better, that Elasticsearch supports spatial filters, not only by geojson, but also by geotile_grid key (x/y/z-tuple) or h3-identifier.

nreese commented 2 years ago

Or even better, that Elasticsearch supports spatial filters, not only by geojson, but also by geotile_grid key (x/y/z-tuple) or h3-identifier.

It would be ideal to have geometry handled by elasticsearch. Kibana does not have logic to generate hexagons from identifier at the moment. Would you mind creating an issue for Elasticsearch?