-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Search Sessions] fix saved object can be created even if courier:batchSearches is enabled #105407
[Search Sessions] fix saved object can be created even if courier:batchSearches is enabled #105407
Conversation
@@ -287,6 +287,8 @@ export class SearchSource { | |||
// This still uses bfetch for batching. | |||
if (!options?.strategy && syncSearchByDefault) { | |||
options.strategy = ES_SEARCH_STRATEGY; | |||
// `ES_SEARCH_STRATEGY` doesn't support search sessions, hence remove sessionId | |||
options.sessionId = undefined; |
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.
There are a lot of ways how to handle this, but since this fix is focused on courier:batchSearches
, I suggest we contain the fix together with the option usage.
Long term, I think we find a how-to avoid search session overhead (both on UI and server) when running a search strategy that doesn't support search sessions. (see pr description for more details)
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.
Won't this disable client side caching of responses as well 🤔 ?
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.
Yes @lizozom!
But otherwise not sure how to solve it also keeping the fix surface as small as possible:
We want cache to still work, so we need to pass sessionId
,
but then we also don't want to trackSearch
in client-side session service and ideally don't want to pass sessionId to the server.
I don't think we should put such conditional logic that depends on a specific strategy into client-side search interceptor, hence I suggest going with removing sessionId in searchSource level
Pinging @elastic/kibana-app-services (Team:AppServices) |
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.
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.
Nothing like a good old kbn clean
Would be nice to have a functional test for this as well :-)
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Page load bundle
History
To update your PR or re-run it, just comment with: |
Discussed offline. Intentionally, adding only a unit test because the fix is very contained and only for a deprecated option we plan to remove soon |
…chSearches is enabled (elastic#105407)
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
…chSearches is enabled (elastic#105407)
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
…-png-pdf-report-type * 'master' of github.com:elastic/kibana: (75 commits) [Search Sessions] Don’t try to delete errored searches (elastic#105434) [Search Sessions] fix saved object can be created even if courier:batchSearches is enabled (elastic#105407) [Remote Clusters] Fixed remote clusters details flyout for long strings (elastic#105592) [ML] Functional tests - re-activate a11y tests (elastic#105198) [APM] Typed client-side routing (elastic#104274) [Canvas] Expression error (elastic#103048) [ML] Fixing job wizard with missing description (elastic#105574) [Security Solution][Alerts] - Add alerts subfeature UI (elastic#105505) Upgrade EUI to v35.0.0 (elastic#105127) [Reporting] Clean up types for internal APIs needed for UI (elastic#105508) skip flaky suite (elastic#105087) [Workplace Search] Fix Chrome issues with GitHub sources (elastic#105680) [Fleet] Add containerized fleet server instructions to Fleet README (elastic#105669) [ML] Add api integration test for analytics map endpoint (elastic#105531) Fixes cypress flake across two tests (elastic#105645) [Logs&Metrics UI] add owner properties to plugin manifest (elastic#105580) chore(NA): introduce preset for jest-integration tests on @kbn/test (elastic#105144) [Enterprise Search] Added Thumbnails to Search UI (elastic#104199) Translate App Search credentials list (elastic#105619) [APM] APM agent config created prior to Fleet migration is not injected into integration policy (elastic#105504) ... # Conflicts: # x-pack/plugins/reporting/common/types.ts # x-pack/plugins/reporting/public/management/report_listing.test.tsx
Summary
This pr fixes #104311: the issue is when
courier:batchSearches
enabled (which essentially switches all searches that go through thesearchSource
fromasync
tosync
search), we still treat those as they are async from a search session perspective.There are a lot of ways how to handle this, but since this fix is focused on
courier:batchSearches
, I suggest we contain the fix together with the option usage.Considerations
Dashboard with different panels
With this option enabled you can have a dashboard that uses both async search and sync search, because
courier:batchSearches
is applied on SearchSource level and, for example, tsvb doesn't use it.In this case, only async searches will use
sessionId
and only those will get into the session object.Using search strategy that doesn't support search session
You can still use search service as follows:
this is incorrect usage because
es
search strategy doesn't support sessions, but it will still create all the session overhead.@lizozom, @lukasolson, Should I create an issue to improve this?
Checklist
Risk Matrix
Fix is very contained. Change is applied only when
courier:batchSearches
is used.For maintainers