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

[Lens] Accept filter definition via URL query parameters #97249

Closed
ghudgins opened this issue Apr 15, 2021 · 6 comments
Closed

[Lens] Accept filter definition via URL query parameters #97249

ghudgins opened this issue Apr 15, 2021 · 6 comments
Labels
enhancement New value added to drive a business result Feature:Lens impact:needs-assessment Product and/or Engineering needs to evaluate the impact of the change. Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects

Comments

@ghudgins
Copy link

Describe the feature:
Allow chart filter information to be passed into Lens via URL query parameter

Today there is a local/session storage for this information but you cannot generate this from another application outside of Kibana

Describe a specific use case for the feature:
When designing a custom application
I would like to construct a link into Lens carrying the current query context from my application
So I can lean on Kibana's functionality for data exploration rather than building it myself

@ghudgins ghudgins added enhancement New value added to drive a business result Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Lens labels Apr 15, 2021
@ghudgins ghudgins added this to Long-term goals in Lens via automation Apr 15, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@wylieconlon
Copy link
Contributor

@ghudgins I think this is actually a bug, it has been possible in the past to pass in filters from the URL into Lens. It is also possible for other apps to construct Lens URLs using the LensComponent which should allow filters to be passed in.

One of the things that is has never been possible to add via URL is the KQL/Lucene query as text- although it's possible to add via the LensComponent.

@wylieconlon wylieconlon added :KibanaApp/fix-it-week bug Fixes for quality problems that affect the customer experience and removed enhancement New value added to drive a business result labels Apr 15, 2021
@wylieconlon wylieconlon moved this from Long-term goals to Minor bugs in Lens Apr 15, 2021
@flash1293
Copy link
Contributor

As discussed offline, right now only pinned filters and the time range can be synced via URL. Adding query/regular filters to this (maybe even the full state) would be an interesting extension.

@flash1293 flash1293 removed :KibanaApp/fix-it-week bug Fixes for quality problems that affect the customer experience labels Apr 15, 2021
@flash1293 flash1293 moved this from Minor bugs to Long-term goals in Lens Apr 15, 2021
@wylieconlon
Copy link
Contributor

Sorry, I confused myself. The only filters that are typically passed in the URL today are Pinned Filters, which are passed in using the global state _g instead of app state _a. We can add the Lens filters to the app state _a to match the behavior of Discover and Visualize. This does not affect the LensComponent, which is already able to provide all of these options in the Lens state.

The existing behavior is that if I pin a filter from Discover and then open Lens, I will see a URL like this. Only pinned filters are kept.

/app/lens#/?_g=(filters:!(('$state':(store:globalState),meta:(alias:!n,disabled:!f,index:'90943e30-9a47-11e8-b64d-95841ca0b247',key:bytes,negate:!f,params:(gte:1000,lt:!n),type:range),range:(bytes:(gte:1000,lt:!n)))),refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))

The proposed change here is to add filters and query parameters into the Lens app state parameter, matching what Discover and Visualize do.

@wylieconlon wylieconlon added the enhancement New value added to drive a business result label Apr 15, 2021
@stratoula stratoula added the impact:needs-assessment Product and/or Engineering needs to evaluate the impact of the change. label Feb 15, 2023
@stratoula
Copy link
Contributor

This is possible now with the new Share capabilities of Lens. You can share a url containing filters and the context will be passed to the new window

@ElanHasson
Copy link

@stratoula Where is the share in lens? I'm not seeing it like I do when I'm using /app/dashboards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:Lens impact:needs-assessment Product and/or Engineering needs to evaluate the impact of the change. Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
No open projects
Lens
  
Long-term goals
Development

No branches or pull requests

6 participants