-
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
[Lens] Filters aggregation #75635
[Lens] Filters aggregation #75635
Conversation
4e7c26b
to
c5f18b4
Compare
Thanks @mbondyra this is a great start!!
not sure why we need
not sure I understand the questions. In general, I don't think search query agg works well with record fields. Users will usually use search query with one or multiple conditions. I wonder if we should allow to use records with search query aggregation
we should start a text review document @gchaps can you help? I don't like calling it just filter in the popup left side menu, a filter has so many meanings in Kibana. So either filter aggregation of
Sounds good :) |
6c41209
to
a2d5d71
Compare
@AlonaNadler This is the first PR of several- we are expecting to do this work in several chunks before the feature freeze. The next chunk is to deal with the field selector, such as "Records," since @cchaos has asked for several changes. |
I think this PR is pretty darn close. I would only have minor feedback on the UI (when we get to the wrap-up stages).
Whatever naming we do come up with, the idea is to try to embody the idea that this is a completely custom x-axis based on the query/filters that the user creates.
Certainly even the chart has problems rendering these which is why I my original idea was to require (the asterisk) a custom label. This would force users to write a smaller label that the chart could actually display. But the way you have it wrapping even if they do type in a long custom label works for me.
This is because the dropdown does not exist in a portal. @dziyanadzeraviankina is working on a PR for this. Some responses to @AlonaNadler's review
I would recommend the query being
This automatically happens as the user types (when the input is focused) but it doesn't support the ability to grow inline. When the config popover moves to a flyout, it will solve several problems. I think it will be easier to remove the "Field" option as it doesn't sit above the aggregations. And it will solve the popover inception and click outside handling. |
| 2. Placeholders for query and label I'm not sure everyone knows what e.g. means. I suggest using "Example: " instead. I've asked @debadair for suggestions for the Search query/Filters terminology in the left navigation. I'm happy to review further if you set up a text document. |
I'm not sure introducing new terminology for the filters aggregation (search query aggregation) that overloads two already overloaded terms (search and query) is a good alternative to overloading filter. A "filter" in the filters bucket agg consists of a bucket name and a query that defines the criteria for including a hit in the bucket. Each added filter (Search query) is actually a new bucket, isn't it? I don't especially like bucket as an end-user term, but it is used in Visualize. If we're introducing new terminology, maybe these are bucket filters or category filters? |
@mbondyra really nice work!! Few comments: Moving between chart types with filter aggregations work very smooth 👍
In many places in Lens we explicitly avoided Visualize and Elasticsearch terminology in favor of friendlier names. We are currently in pursuit of a friendlier name for the filter aggregation. bucket filters worth considering. In general, if we don't find something we agree is an improvement we might need to ever back to filter aggs playing with the PR one thing that I kept stumbling upon if I'm typing the query from the search bar, I'm used to clicking escape to leave the suggestions and submit the query. In Lens it closes the entire popup, I lost my queries like that multiple times Seems like we are missing a @cchaos in the query popup it hard to tell this is a search bar, perhaps like it says |
a2d5d71
to
67172bf
Compare
I saw this happen to me too, but I'm pretty sure this will be solved when moving to the flyout because then it wouldn't be closing 2 popovers, only the search one which should automatically save. So let's wait on this issue til the flyout implementation is done.
@AlonaNadler Can you explain further what the difference is between adding a prefix like "Search" to the input and the comment above? The global KQL bar just has the placeholder text as "Search" vs the example that is shown in Lens (which I honestly prefer). |
67172bf
to
66aada5
Compare
@wylieconlon @dej611 probably there'll be some small design/copy changes but I'd like to collect some feedback on technical level - I think it's ready to review/test. 🙏 🙂 |
@cchaos thanks for you help. When it comes to the naming, we've setup the copy document and @gchaps is on it. I'll pass you the link as well. |
… into lens/filters_aggregation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested again and looks good to me.
We really have to work on the "Grouping" options as they can get super confusing (for example if you are working with two filters):
However it was never really working nice, so I would be fine solving this separately (I think you created an issue for this already, right?)
Edit: I just saw there is some discussion about this going on in a comment thread in this PR - if we can do some easy improvements in the scope of this PR, even better. I will keep my approval as I'm also fine with addressing it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM! I think we'll need to re-address so a11y aspects of the dnd panels with buttons. But I think this is a repeatable pattern which we can address in a follow up
x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/dimension_popover.tsx
Show resolved
Hide resolved
…onfig_panel/dimension_popover.tsx
…_frame/config_panel/dimension_popover.tsx" This reverts commit c18c658.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The behavior is working exactly like I'd expect, except for the one popover state bug I found. I think this deserves more unit tests, but I am going to approve with the understanding that you can add these tests. I appreciate the issues describing more followups.
...lugins/lens/public/indexpattern_datasource/operations/definitions/filters/filter_popover.tsx
Outdated
Show resolved
Hide resolved
setInputValue(value); | ||
}, [value, setInputValue]); | ||
|
||
const onChangeDebounced = React.useMemo(() => debounce(onChange, 256), [onChange]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm seeing console warnings caused by slowness in the onChange
function here: [Violation] 'setTimeout' handler took 169ms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These warnings happen in most of places when we modify the state so deeply. I think We need more top-down approach here instead of just trying to patch this single place.
x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.tsx
Show resolved
Hide resolved
x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.tsx
Show resolved
Hide resolved
x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.tsx
Show resolved
Hide resolved
import { IndexPattern } from '../../../types'; | ||
import { QueryStringInput, Query } from '../../../../../../../../src/plugins/data/public'; | ||
|
||
export const FilterPopover = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This UI component appears to have no tests. I think the minimum level of testing might be something around the popover handling because I found a weird behavior.
}); | ||
}); | ||
|
||
describe('Modify search query', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No tests around the popover UI or drag and drop?
...lugins/lens/public/indexpattern_datasource/operations/definitions/filters/filter_popover.tsx
Outdated
Show resolved
Hide resolved
@mbondyra One more unexpected behavior I found (which is the same as Visualize) is that when I click on a bar in the chart, the filter is using the DSL instead of showing a nice editor. Since this is the current behavior I think it's fine, but if there's anything you can see to easily improve the behavior it would be nice to have. |
e47402f
to
2978769
Compare
💚 Build SucceededBuild metrics@kbn/optimizer bundle module count
async chunks size
page load bundle size
History
To update your PR or re-run it, just comment with: |
…s-for-710 * 'master' of github.com:elastic/kibana: (65 commits) Separate url forwarding logic and legacy services (elastic#76892) Bump yargs-parser to v13.1.2+ (elastic#77009) [Ingest Manager] Shared Fleet agent policy action (elastic#76013) [Search] Re-add support for aborting when a connection is closed (elastic#76470) [Search] Remove long-running query pop-up (elastic#75385) [Monitoring] Fix UI error when alerting is not available (elastic#77179) do not log plugin id format warning in dist mode (elastic#77134) [ML] Improving client side error handling (elastic#76743) [Alerting][Connectors] Refactor IBM Resilient: Generic Implementation (phase one) (elastic#74357) [Docs] some basic searchsource api docs (elastic#77038) add cGroupOverrides to the legacy config (elastic#77180) Change saved object bulkUpdate to work across multiple namespaces (elastic#75478) [Security Solution][Resolver] Replace Selectable popover with badges (elastic#76997) Removing ml-state index from archive (elastic#77143) [Security Solution] Add unit tests for histograms (elastic#77081) [Lens] Filters aggregation (elastic#75635) [Enterprise Search] Update WS Overview logic to use new config data (elastic#77122) Cleanup type output before building new types (elastic#77211) [Security Solution] Use safe type in resolver backend (elastic#76969) Use proper lodash syntax (elastic#77105) ... # Conflicts: # x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/node_allocation.tsx
Fixes #61330
Demo
Things to figure out:
1. Copy - in the making