-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Description
Part of https://github.com/elastic/dev/issues/1209
Search Sessions
A search session refers to running one or more ES searches in the background, in the context of a dashboard, or another application, allowing a user to come back and view the results later.
Proof of Concept
The POC PR includes a partial implementation of the Background Search feature, used for demo purposes. It also contains a sample plugin.
It should be reviewed and serve as a basis for the full implementation.
Tasks
(*) Means that the capability was implemented in the POC.
Improve search API
- Refactor
fetchSoonandcallClientto isolatemsearch - Improve typing around requests / responses
- Improve providing context to strategies - Client and Server. Logs example.
- Allow reusing strategies on server side
- Expose search API on server.
- Introduce a new search timeout
RFC
- Finalize RFC
- Architecture Review
Client side BackgroundSession
Server side Background Session Service
- (*) Implement server side background session service API (trackId / store / getId) [Search] Implement a background search service #61743
- (*) Implement server side background session service monitoring loop that syncs tracked IDs to a saved objcet if a user decides to store the session.
- Handle edge case of extending expiration of requests not generated by async search
- Implement versioned updates (concurrency)
- Don't allow adding new requests to a complete / error session
Monitoring service
- ES to allow monitoring server to get Background Search metadata
- Create a task manager task to track session progress (POC)
Management
-
Clear a session upon navigating away from each application \ canceling an ongoing refresh.Warn about navigating away with existing session. - Management / Management UI
UI
- Send to background UI
- Kibana global notifications
- Search session inspector [Search Sessions] Search session inspector #88846
Improvements
- [Search] Make URL generation to restore a background search optional [Search Session] Use new URL Service for session restoration #85126 (needed to support apps that can't restore all the state from the URL)
- [Search Sessions] Restore state from SO instead of URL [Search Sessions] Restore state from SO instead of URL #87446
- [Search Sessions] Completed session is "in progress" on management screen for some time [Search Sessions] Completed session is "in progress" on management screen for some time #88194
- [Search Sessions] Cancel dialog improvements [Search Sessions] Cancel search session dialog is confusing for a completed, errored or expired session #89276
Misc
- Telemetry [Search] Add telemetry for data plugin search service #70677
- Use search service in TSVB (Server side)
- Use search service in Vega
- Use search service in Timelion
Flaky tests
- Failing test: X-Pack Background Search UI (Enabled WIP Feature).x-pack/test/send_search_to_background_integration/tests/apps/management/search_sessions/sessions_management·ts - search sessions management Search search sessions Management UI New search sessions Saves a session and verifies it in the Management app Failing test: X-Pack Background Search UI (Enabled WIP Feature).x-pack/test/send_search_to_background_integration/tests/apps/management/search_sessions/sessions_management·ts - search sessions management Search search sessions Management UI New search sessions Saves a session and verifies it in the Management app #89069
- Failing test: Jest Tests.x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table - Background Search Session Management Table fetching sessions data re-fetches data Failing test: Jest Tests.x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table - Background Search Session Management Table fetching sessions data re-fetches data #88928
Docs
- User facing docs [Data] Write documentation for users on Kibana Search Sessions #88736
- Developer examples (example plugin) [Search Sessions] Example plugin and dev docs #89278
keep_alive time
The ElasticSearch _async_search endpoint stores results of queries that ran longer than wait_for_completion_timeout by default.
The default keep_alive time is 5 days, and this includes both the query run time and store time. So if keep_alive is 5 days and the query ran for 4 days, it will be stored by default for another 1 day. If a query did not complete until the keep_alive time is reached - it will be canceled.
So while implementing this feature, it is important that Kibana doesn't store all queries for that time period. Storing queries for a long time is expensive in terms of both resources and cost. Instead, we should store the data for an initially short time, and then extend it, by sending a GET request to the same search ID, with a longer keep_alive.
Known limitations
- Follow up searches - Some visualizations send additional searches based on the results of an initial search. For example, known examples are a pie chart with an Other bucket or a histogram based on the non default timefield.
If we rely on the browser to track and store outgoing requests for a given background search, navigating away from the visualization before the secondary request was sent, will result in a partial background search that triggers an additional background search when opened.
The solution to this seems to be supporting server side execution, but this maybe complex and time consuming.- ES support: When can we expect ES atomic handling of the two examples mentioned (pie charts, histogram)
- Do Maps and TSVB have similar limitations?
- TSVB does not use the existing search service. More over, it sends multiple requests from the server side. This might be resolved by making the search service available on the server side and using it from TSVB, or having TSVB use the
_async_searchAPI and return the search IDs somehow to the client. - Timelion won't be supported.
- Completion notifications should be available to the user, regardless which application he's using ATM. This requires implementing a generic push notifications service (With Web Workers?). Maybe implemented in Phase 2.
- Web Sockets - can we use them on cloud somehow?