[Search] Refactor service to register search strategies, not providers#60342
Merged
lizozom merged 158 commits intoelastic:masterfrom Jun 8, 2020
Merged
[Search] Refactor service to register search strategies, not providers#60342lizozom merged 158 commits intoelastic:masterfrom
lizozom merged 158 commits intoelastic:masterfrom
Conversation
32 tasks
lukasolson
commented
Jun 5, 2020
x-pack/plugins/data_enhanced/public/search/async_search_strategy.ts
Outdated
Show resolved
Hide resolved
pgayvallet
approved these changes
Jun 8, 2020
| "getMetrics": [Function], | ||
| }, | ||
| }, | ||
| "getSearchStrategy": [MockFunction], |
Contributor
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
lizozom
approved these changes
Jun 8, 2020
Contributor
lizozom
left a comment
There was a problem hiding this comment.
@lukasolson I'm approving to unblock merging, but I would appreciate you taking a look
lizozom
pushed a commit
to lizozom/kibana
that referenced
this pull request
Jun 8, 2020
elastic#60342) * Add async search strategy * Add async search * Fix async strategy and add tests * Move types to separate file * Revert changes to demo search * Update demo search strategy to use async * Add async es search strategy * Return response as rawResponse * Poll after initial request * Add cancellation to search strategies * Add tests * Simplify async search strategy * Move loadingCount to search strategy * Update abort controller library * Bootstrap * Abort when the request is aborted * Add utility and update value suggestions route * Fix bad merge conflict * Update tests * Move to data_enhanced plugin * Remove bad merge * Revert switching abort controller libraries * Revert package.json in lib * Move to previous abort controller * Add support for frozen indices * Fix test to use fake timers to run debounced handlers * Revert changes to example plugin * Fix loading bar not going away when cancelling * Call getSearchStrategy instead of passing directly * Add async demo search strategy * Fix error with setting state * Update how aborting works * Fix type checks * Add test for loading count * Attempt to fix broken example test * Revert changes to test * Fix test * Update name to camelCase * Fix failing test * Don't require data_enhanced in example plugin * Actually send DELETE request * Use waitForCompletion parameter * Use default search params * Add support for rollups * Only make changes needed for frozen indices/rollups * Only make changes needed for frozen indices/rollups * Add back in async functionality * Fix tests/types * Fix issue with sending empty body in GET * Don't include skipped in loaded/total * Don't wait before polling the next time * Add search interceptor for bulk managing searches * Simplify search logic * Fix merge error * Review feedback * UI to stop async searches * Add service for running beyond timeout * Refactor abort utils * Remove unneeded changes * Add tests * Refactor search service to register strategies directly * Remove accidental change * re-generate docs * Fix merge * types * doc * eslint * Fix async strategy jest test * type fix * Use getStartServices in search strategies * Code review + snapshot * eslint * Type script Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Liza K <liza.katz@elastic.co>
lizozom
added a commit
that referenced
this pull request
Jun 8, 2020
#60342) (#68545) * Add async search strategy * Add async search * Fix async strategy and add tests * Move types to separate file * Revert changes to demo search * Update demo search strategy to use async * Add async es search strategy * Return response as rawResponse * Poll after initial request * Add cancellation to search strategies * Add tests * Simplify async search strategy * Move loadingCount to search strategy * Update abort controller library * Bootstrap * Abort when the request is aborted * Add utility and update value suggestions route * Fix bad merge conflict * Update tests * Move to data_enhanced plugin * Remove bad merge * Revert switching abort controller libraries * Revert package.json in lib * Move to previous abort controller * Add support for frozen indices * Fix test to use fake timers to run debounced handlers * Revert changes to example plugin * Fix loading bar not going away when cancelling * Call getSearchStrategy instead of passing directly * Add async demo search strategy * Fix error with setting state * Update how aborting works * Fix type checks * Add test for loading count * Attempt to fix broken example test * Revert changes to test * Fix test * Update name to camelCase * Fix failing test * Don't require data_enhanced in example plugin * Actually send DELETE request * Use waitForCompletion parameter * Use default search params * Add support for rollups * Only make changes needed for frozen indices/rollups * Only make changes needed for frozen indices/rollups * Add back in async functionality * Fix tests/types * Fix issue with sending empty body in GET * Don't include skipped in loaded/total * Don't wait before polling the next time * Add search interceptor for bulk managing searches * Simplify search logic * Fix merge error * Review feedback * UI to stop async searches * Add service for running beyond timeout * Refactor abort utils * Remove unneeded changes * Add tests * Refactor search service to register strategies directly * Remove accidental change * re-generate docs * Fix merge * types * doc * eslint * Fix async strategy jest test * type fix * Use getStartServices in search strategies * Code review + snapshot * eslint * Type script Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Liza K <liza.katz@elastic.co> Co-authored-by: Lukas Olson <olson.lukas@gmail.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Waiting on #60058.
This PR updates the data plugin search service API. Instead of exposing a
registerSearchStrategyProviderfunction, which is called every timesearchis called, it exposes aregisterSearchStrategyfunction which is expected to return the search strategy directly.In other words, it moves the responsibility of instantiating the search strategy to plugins themselves, rather than taking care of instantiating them as part of the search service. This will be necessary in situations where a search strategy needs to do some sort of setup that persists across multiple
searchcalls, or when a plugin needs to modify or provide different dependencies.Checklist
Delete any items that are not applicable to this PR.
For maintainers