-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[filters] filter operator registry and spatial_filter operator #111897
Conversation
Pinging @elastic/kibana-gis (Team:Geo) |
💔 Build Failed
Failed CI Steps
Test FailuresKibana Pipeline / jest / Jest Tests.x-pack/plugins/maps/public/classes/sources/es_geo_grid_source.ESGeoGridSource getGeoJsonWithMeta Should configure the SearchSource correctlyStandard Out
Stack Trace
Kibana Pipeline / general / Chrome UI Functional Tests.test/functional/apps/discover/_filter_editor·ts.discover app discover filter editor filter editor should show the phrases if you re-open a phrases filterStandard Out
Stack Trace
Kibana Pipeline / general / Chrome UI Functional Tests.test/functional/apps/discover/_filter_editor·ts.discover app discover filter editor filter editor should show the phrases if you re-open a phrases filterStandard Out
Stack Trace
and 1 more failures, only showing the first 3. Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Page load bundle
Unknown metric groupsAPI count
async chunk count
References to deprecated APIs
History
To update your PR or re-run it, just comment with: |
Closing, out of date and priorities have shifted |
…filter disappear from map (#154087) Fixes #107044 and #109340 ### Background In Maps, users can [create spatial filters](https://www.elastic.co/guide/en/kibana/current/maps-create-filter-from-map.html). The filter is added to the Filter bar. <img width="300" alt="Screen Shot 2021-09-03 at 4 07 33 PM" src="https://user-images.githubusercontent.com/373691/133142628-9b03dec2-69ee-4c7c-ac8d-841168c88a94.png"> There are 2 important properties about spatial filters created from a Map: * `filter.meta.type` is set to `spatial_filter`. Maps uses `filter.meta.type` to identify spatial filters. Spatial filters are displayed on the map to provide a visual reference of all applied spatial filters. * `filter.meta.isMultiIndex` is set to true since Elasticsearch Query DSL for the filter is not tied to a single index pattern or field. The Elasticsearch Query DSL is generated in such a way that the filter works for all map layers, regardless of index pattern or spatial field. In the screenshot above a single filter is filtering both layers, even though they are from different index patterns and different spatial fields. * Each layer identifies one or more geo_point or geo_shape fields that is used to display features for that layer * The Elasticsearch Query DSL combines these into a `bool.should` clause where each field provides a `bool.must` clause ensuring the spatial field exists and that the document satisfies the spatial filter. Any document matching any of the `bool.must` clauses allows the bool.should clause to produce a match. ### Solution [Earlier solution](#111897) proposed Sept 2021. This original effort was abandoned as priorities shifted. I investigated re-opening original solution, which included a filter operator registry. This solution is no longer appropriate with `combined` filters. Instead, this PR takes a less complex approach and when `filter.meta.isMultiIndex`, the filter editor displays the following: * Only displays "custom" editor. "Values" editor is not available * "Edit as filter values" toggle button is not visible * Data view select is not visible * onSubmit does not change filter to "custom" unless DSL is edited <img width="500" alt="Screen Shot 2023-03-30 at 10 33 58 AM" src="https://user-images.githubusercontent.com/373691/228918145-61ddda8b-43a3-44e8-8316-a803473f5a36.png"> ### Test instructions * Install web logs sample data set and open "[Logs] Total Requests and Bytes" map * Click wrench and select "Draw bounds to filter data". Draw bounds and create a filter. * In the Filter bar, Click "Edit filter". * Change the label and click save. The filter should still be displayed on the map and the filter pill should have a new label. <strike>Note for testing, until #153816 is merged, spatial filters with a single geofield will not set `isMultiIndex` to true and will still have the errors referenced in the issues. Once #153816 is merged all spatial filters will set isMultiIndex.</strike> --------- Co-authored-by: kibanamachine <[email protected]>
Fixes #109340 and #107044
Background
In Maps, users can create spatial filters. The filter is added to the Filter bar.
There are 2 important properties about spatial filters created from a Map:
filter.meta.type
is set tospatial_filter
. Maps usesfilter.meta.type
to identify spatial filters. Spatial filters are displayed on the map to provide a visual reference of all applied spatial filters.filter.meta.isMultiIndex
is set to true since Elasticsearch Query DSL for the filter is not tied to a single index pattern or field. The Elasticsearch Query DSL is generated in such a way that the filter works for all map layers, regardless of index pattern or spatial field. In the screenshot above a single filter is filtering both layers, even though they are from different index patterns and different spatial fields.bool.should
clause where each field provides abool.must
clause ensuring the spatial field exists and that the document satisfies the spatial filter. Any document matching any of thebool.must
clauses allows the bool.should clause to produce a match.Test instructions
Changes to Data plugin
spatial_filter
type.meta.type
and moving the logic into Operator interface.filterEditor
service.Changes to Maps plugin
filter.meta.isMultiIndex = true
for all generated filters even if there is only a single geo field. The reason for this is that geo field names are decoupled from index patterns and there is no way of knowing if a geo field name exists on multi index patterns. In practice, any spatial filter created from the map is not coupled to field/index, thus its a multi index filter.setup
to organize files used during setup phase sincepublic
folder was getting a bit unorganized.