-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
[data.search] Simplify poll logic and improve types #82545
Conversation
Co-authored-by: Anton Dosov <dosantappdev@gmail.com>
@elasticmachine merge upstream |
@elasticmachine merge upstream |
This reverts commit 01e8a06.
return es | ||
.search({ ...request, params: dsl }, options, deps) | ||
.pipe(mergeMap((esSearchRes) => queryFactory.parse(request, esSearchRes))); | ||
return es.search({ ...request, params: dsl }, options, deps).pipe( |
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.
We now shim totals in the responses in the route handler.
This means that internally, all strategies should work with the new format {value: 123, relation: 'eq'}
.
We shimmed the types here to avoid test failures.
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.
SIEM/Endpoint LGTM
💚 Build SucceededMetrics [docs]Module Count
Distributable file count
Page load bundle
History
To update your PR or re-run it, just comment with: |
* [Search] Add request context and asScoped pattern * Update docs * Unify interface for getting search client * Update examples/search_examples/server/my_strategy.ts Co-authored-by: Anton Dosov <dosantappdev@gmail.com> * Review feedback * Fix checks * Fix CI * Fix security search * Fix test * Fix test for reals * Fix types * [data.search] Refactor search polling and improve types * Fix & update tests & types * eql totals * doc * Revert "eql totals" This reverts commit 01e8a06. * lint * response type * shim inside strategies * shim for security * fix eql params Co-authored-by: Anton Dosov <dosantappdev@gmail.com> Co-authored-by: Liza K <liza.katz@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> # Conflicts: # src/plugins/data/server/index.ts # src/plugins/data/server/server.api.md
…84292) * [data.search] Simplify poll logic and improve types (#82545) * [Search] Add request context and asScoped pattern * Update docs * Unify interface for getting search client * Update examples/search_examples/server/my_strategy.ts Co-authored-by: Anton Dosov <dosantappdev@gmail.com> * Review feedback * Fix checks * Fix CI * Fix security search * Fix test * Fix test for reals * Fix types * [data.search] Refactor search polling and improve types * Fix & update tests & types * eql totals * doc * Revert "eql totals" This reverts commit 01e8a06. * lint * response type * shim inside strategies * shim for security * fix eql params Co-authored-by: Anton Dosov <dosantappdev@gmail.com> Co-authored-by: Liza K <liza.katz@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> # Conflicts: # src/plugins/data/server/index.ts # src/plugins/data/server/server.api.md * doc Co-authored-by: Lukas Olson <olson.lukas@gmail.com>
Summary
This PR simplifies the async search polling observable and search strategy authoring.
Any new search strategy should be implementing a method that fetches partial data and formats it into a
IKibanaSearchResponse
.pollSearch
will periodically call this method, until response is complete or until an error or an abort have occurred.For example:
Checklist
Delete any items that are not applicable to this PR.
For maintainers