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

[Log Explorer] Add filter controls customization point #158561

Closed
weltenwort opened this issue May 26, 2023 · 8 comments · Fixed by #162013
Closed

[Log Explorer] Add filter controls customization point #158561

weltenwort opened this issue May 26, 2023 · 8 comments · Fixed by #162013
Assignees
Labels
Feature:Discover Discover Application Feature:Input Control Input controls visualization Feature:LogsExplorer Logs Explorer feature Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas

Comments

@weltenwort
Copy link
Member

weltenwort commented May 26, 2023

📓 Summary

We want to offer curated filters by well-known fields using the unified input control group. While the filters will be curated for individual datasets in the future, we want to start out with a persistent namespace filter.

✔️ Acceptance criteria

  • There is a customization point below the data stream picker and search bar.
  • In the default profile it doesn't render anything and doesn't take up space.
  • In the log explorer profile (profile id to be determined)...
    • it renders an input control group.
    • there is a pre-defined options list control, in the control group that filters for the data_stream.namespace field in the currently active data view.
  • There is a way in which the control group filters can be injected into the search source, e.g. a getFilters callback in the customization interface that is called before fetching.
  • There is an example usage for the new customization point in examples/discover_customization_examples and a test for that example in test/examples/discover_customization_examples.

🎨 Mock-ups

⚠️ these mock-ups are just for illustration purposes and don't exactly represent the desired outcome

image

@weltenwort weltenwort self-assigned this May 26, 2023
@botelastic botelastic bot added the needs-team Issues missing a team label label May 26, 2023
@ThomThomson ThomThomson added Feature:Discover Discover Application Feature:Input Control Input controls visualization Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. labels May 26, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@botelastic botelastic bot removed the needs-team Issues missing a team label label May 26, 2023
@ThomThomson
Copy link
Contributor

@elastic/kibana-data-discovery tagging this with both of our teams as we may need to work together to get the Controls working nicely with Discover.

@weltenwort
Copy link
Member Author

weltenwort commented Jun 2, 2023

@ThomThomson currently the idea was for us to add a customization point to Discover to plug our custom filter controls into. That would get your team off the critical path for now, but leaves open the option of moving it from a customization point into a native search bar or Discover feature in the future. Does that make sense for you?

@ThomThomson
Copy link
Contributor

Sounds good @weltenwort! We'll keep our tag on this to keep an eye on it for the time being.

@davismcphee
Copy link
Contributor

PoC of this work for reference: #159318

@weltenwort
Copy link
Member Author

Options for persisting the controls

The POC created by @davismcphee already goes a long way to show what the extension point will probably look like. While it's out of scope for this issue, we should try to think ahead about how we will allow integrations to ship dataset-specific controls. This might influence how we design the API that injects filters into the search source.

Option A: input controls in unified search and search sources

If the unified search bar natively supported control groups the controls could be persisted in the serialized search source:

  • persisted in serialized search source JSON blob
  • automatically included in the request
  • complex change, because it's widely used throughout Kibana
  • has been rejected before

Option B: persist control groups in saved search

The control group definition and filter values could be persisted in the saved search and passed to the control group component when the saved search is loaded.

  • persisted in a saved search attribute, local to Discover
  • filters must be injected into the search source as shown in the POC
  • requires synchronization code from filters to control groups and back

Option C: persist control group embeddable state in saved search

Since a control group can be consumed as an embeddable, we could also store the embeddable state in the saved search.

  • persisted in a saved search attribute, local to Discover
  • filters must be injected into the search source as shown in the POC
  • requires synchronization code from filters to control groups and back
  • automatically migrated using the embeddable's persistable state

Option D: read control group state from integration

Since the dataset selector is supposed to be the bridge between fleet and Kibana's analytics apps, it could also read the control group definitions from any asset of an integration via a fleet API and inject it into the control group elements.

  • persisted in any package asset or manifest
  • filters must be injected into the search source as shown in the POC
  • requires synchronization code from filters to control groups and back
  • read-only unless we implement extra fleet package mutation APIs

@weltenwort
Copy link
Member Author

@weltenwort weltenwort changed the title Create extension point for filter controls [Log Explorer] Create extension point for filter controls Jun 23, 2023
@weltenwort weltenwort removed their assignment Jun 29, 2023
@mohamedhamed-ahmed mohamedhamed-ahmed self-assigned this Jun 30, 2023
@weltenwort weltenwort changed the title [Log Explorer] Create extension point for filter controls [Log Explorer] Add filter controls customization point Jun 30, 2023
@mohamedhamed-ahmed mohamedhamed-ahmed added the Feature:Logs UI Logs UI feature label Jul 6, 2023
mohamedhamed-ahmed added a commit that referenced this issue Aug 2, 2023
closes #158561

## 📝  Summary

This PR adds a new customization point to allow for prepending custom
filter controls to the search bar.
At the moment we are only showing a default namespace filter, once this
is ready we will then check how to provide curated filters per
integration.

## ✅  Testing

1. Make sure to have some documents to different data sets with
different namespace, you can use [this
document](https://www.elastic.co/guide/en/elasticsearch/reference/current/set-up-a-data-stream.html)
as an example
2. Navigate to Discover with the log-explorer profile, `/p/log-explorer`
3. Validate that the new filter control is there
4. Filter using this new control and make sure documents are filtered
out

## 🎥 Demo


https://github.com/elastic/kibana/assets/11225826/6828f62f-dd09-42bd-930c-dd7eaf94958b

---------

Co-authored-by: kibanamachine <[email protected]>
@gbamparop gbamparop added Feature:LogsExplorer Logs Explorer feature and removed Feature:Logs UI Logs UI feature labels Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Discover Discover Application Feature:Input Control Input controls visualization Feature:LogsExplorer Logs Explorer feature Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants