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

[Search] Refactor service to register search strategies, not providers #60342

Merged
merged 158 commits into from
Jun 8, 2020

Conversation

lukasolson
Copy link
Member

Summary

Waiting on #60058.

This PR updates the data plugin search service API. Instead of exposing a registerSearchStrategyProvider function, which is called every time search is called, it exposes a registerSearchStrategy function 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 search calls, or when a plugin needs to modify or provide different dependencies.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@mattkime mattkime added v7.9.0 and removed v7.8.0 labels May 7, 2020
@lizozom lizozom mentioned this pull request Jun 1, 2020
32 tasks
@lizozom lizozom changed the title [Search service] Refactor service to register search strategies, not providers [Search] Refactor service to register search strategies, not providers Jun 3, 2020
@lukasolson lukasolson requested a review from a team as a code owner June 7, 2020 13:50
@@ -277,6 +277,7 @@ exports[`SavedObjectsTable import should show the flyout 1`] = `
"getMetrics": [Function],
},
},
"getSearchStrategy": [MockFunction],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that. Will be fixed by #68489

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@lizozom lizozom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lukasolson I'm approving to unblock merging, but I would appreciate you taking a look

@lizozom lizozom merged commit 8174b5c into elastic:master Jun 8, 2020
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Search Querying infrastructure in Kibana refactoring release_note:skip Skip the PR/issue when compiling release notes review v7.9.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants