elastic / kibana

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

[Maps] Ability to have global filter apply only to joined sources, but not to layer-source #43849

Closed fxprunayre closed 4 years ago

fxprunayre commented 5 years ago

Describe the feature:

Would it make sense to add an option to decide if the global filter has to be applied to the vector layer and/or the join layer only?

Describe a specific use case for the feature:

In a number of situation, the vector layer may be a background map (eg. admin boundaries) that user will join with other sources to render thematic maps. But when you enable "apply global filter to layer" then the filter is applied to both the background layer and the joined one.

When building dashboard embedding the map, then control and other viz will focus on the joined layer usually and the global filter should not be applied to main vector layer (which will return no features, and map will be empty)

So instead of having one option for the global filter, 2 options would be provided :

Related discussions: https://discuss.elastic.co/t/maps-apply-global-filter-to-main-vector-layer-and-or-joined-source-only/196247

elasticmachine commented 5 years ago

Pinging @elastic/kibana-gis

nreese commented 5 years ago

This feature is implemented in Elastic Maps and released in Kibana 7.2.0.

Region map visualization will not be receiving any future enhancements. All geospatial enhancements will be delivered in Elastic Maps.

fxprunayre commented 5 years ago

Region map visualization

The feature request is about Map component so we can remove Region Map tag.

This feature is implemented in Elastic Maps and released in Kibana 7.2.0.

It is not, in the map component, per layer you can define "Apply global filter to layer" image then if you enable this, this will issue once embedded in a dashboard a _msearch query like

// The joined layer
{
  "index":"iowindicators"}
{
  "size":0,
  "aggs":{...
  "query":{"bool":{"must":[
     {"match_phrase":{"theme":{"query":"AEP"}}},
     {"range":{"timestamp":{"format":"strict_date_optional_time","gte":"2009-08-26T15:36:54.530Z","lte":"2019-08-26T15:36:54.531Z"}}}],"filter":[],"should":[],"must_not":[]}}}

// The base layer

{"index":"iow_bg_kg_hybasin",}
{
  "size":10000,
  "_source":{"excludes":[],"includes":["geometry","hybcode"]},"stored_fields":["geometry","hybcode"],"script_fields":{},"docvalue_fields":[],
  "query":{"bool":{"must":[
    {"match_phrase":{"theme":{"query":"AEP"}}}
  ],"filter":[{"match_all":{}}],"should":[],"must_not":[]}},"timeout":"30000ms"}

The filter "theme":{"query":"AEP" is applied to both sources and in most case it is only relevant to the joined layer. At least having an option to decide on which source to apply the filter would really make sense:

You can test here and plays with the filter - when filter is active map is blank. https://apps.titellus.net/geonetwork/dashboards/s/iow/goto/065115f6a770160f0239266142678d9d

So I think it could be reopen right ?

nreese commented 5 years ago

As a temporary work around, you can use Custom vector shapes layer source.

In your kibana.yml configure map.regionmap like

map.regionmap:
 layers:
  - name: "my_shapes"
    url: "URL_TO_YOUR_GEOJSON_SHAPES"
    fields:
     - name: "name"
       description: "Name"
     - name: "regionId"
       description: "Region.Id"

Then create a Custom vector shapes layer source and select "my_shapes". This way your shapes will not be filtered by the global filter but the join query can be filtered by the global query