diff --git a/.ci/packer_cache.sh b/.ci/packer_cache.sh
index 11f9ccaeddb1e9..e4b5e35e1e4a9a 100755
--- a/.ci/packer_cache.sh
+++ b/.ci/packer_cache.sh
@@ -2,59 +2,5 @@
set -e
-branch="$(git rev-parse --abbrev-ref HEAD 2> /dev/null)"
-
-# run setup script that gives us node, yarn, and bootstraps the project
-source src/dev/ci_setup/setup.sh;
-
-# download es snapshots
-node scripts/es snapshot --download-only;
-node scripts/es snapshot --license=oss --download-only;
-
-# download reporting browsers
-(cd "x-pack" && yarn gulp prepare);
-
-# cache the chromedriver archive
-chromedriverDistVersion="$(node -e "console.log(require('chromedriver').version)")"
-chromedriverPkgVersion="$(node -e "console.log(require('./package.json').devDependencies.chromedriver)")"
-if [ -z "$chromedriverDistVersion" ] || [ -z "$chromedriverPkgVersion" ]; then
- echo "UNABLE TO DETERMINE CHROMEDRIVER VERSIONS"
- exit 1
-fi
-mkdir -p .chromedriver
-curl "https://chromedriver.storage.googleapis.com/$chromedriverDistVersion/chromedriver_linux64.zip" > .chromedriver/chromedriver.zip
-echo "$chromedriverPkgVersion" > .chromedriver/pkgVersion
-
-# cache the geckodriver archive
-geckodriverPkgVersion="$(node -e "console.log(require('./package.json').devDependencies.geckodriver)")"
-if [ -z "$geckodriverPkgVersion" ]; then
- echo "UNABLE TO DETERMINE geckodriver VERSIONS"
- exit 1
-fi
-mkdir -p ".geckodriver"
-cp "node_modules/geckodriver/geckodriver.tar.gz" .geckodriver/geckodriver.tar.gz
-echo "$geckodriverPkgVersion" > .geckodriver/pkgVersion
-
-echo "Creating bootstrap_cache archive"
-
-# archive cacheable directories
-mkdir -p "$HOME/.kibana/bootstrap_cache"
-tar -cf "$HOME/.kibana/bootstrap_cache/$branch.tar" \
- x-pack/plugins/reporting/.chromium \
- .es \
- .chromedriver \
- .geckodriver;
-
-echo "Adding node_modules"
-# Find all of the node_modules directories that aren't test fixtures, and aren't inside other node_modules directories, and append them to the tar
-find . -type d -name node_modules -not -path '*__fixtures__*' -prune -print0 | xargs -0I % tar -rf "$HOME/.kibana/bootstrap_cache/$branch.tar" "%"
-
-echo "created $HOME/.kibana/bootstrap_cache/$branch.tar"
-
-if [ "$branch" == "master" ]; then
- echo "Creating bootstrap cache for 7.x";
-
- git clone https://github.com/elastic/kibana.git --branch 7.x --depth 1 /tmp/kibana-7.x
- (cd /tmp/kibana-7.x && ./.ci/packer_cache.sh);
- rm -rf /tmp/kibana-7.x;
-fi
+./.ci/packer_cache_for_branch.sh master
+./.ci/packer_cache_for_branch.sh 7.x
diff --git a/.ci/packer_cache_for_branch.sh b/.ci/packer_cache_for_branch.sh
new file mode 100755
index 00000000000000..a9fbe781915b68
--- /dev/null
+++ b/.ci/packer_cache_for_branch.sh
@@ -0,0 +1,62 @@
+#!/usr/bin/env bash
+
+set -e
+
+branch="$1"
+checkoutDir="$(pwd)"
+
+if [[ "$branch" != "master" ]]; then
+ checkoutDir="/tmp/kibana-$branch"
+ git clone https://github.com/elastic/kibana.git --branch "$branch" --depth 1 "$checkoutDir"
+ cd "$checkoutDir"
+fi
+
+source src/dev/ci_setup/setup.sh;
+
+# download es snapshots
+node scripts/es snapshot --download-only;
+node scripts/es snapshot --license=oss --download-only;
+
+# download reporting browsers
+(cd "x-pack" && yarn gulp prepare);
+
+# cache the chromedriver archive
+chromedriverDistVersion="$(node -e "console.log(require('chromedriver').version)")"
+chromedriverPkgVersion="$(node -e "console.log(require('./package.json').devDependencies.chromedriver)")"
+if [ -z "$chromedriverDistVersion" ] || [ -z "$chromedriverPkgVersion" ]; then
+ echo "UNABLE TO DETERMINE CHROMEDRIVER VERSIONS"
+ exit 1
+fi
+mkdir -p .chromedriver
+curl "https://chromedriver.storage.googleapis.com/$chromedriverDistVersion/chromedriver_linux64.zip" > .chromedriver/chromedriver.zip
+echo "$chromedriverPkgVersion" > .chromedriver/pkgVersion
+
+# cache the geckodriver archive
+geckodriverPkgVersion="$(node -e "console.log(require('./package.json').devDependencies.geckodriver)")"
+if [ -z "$geckodriverPkgVersion" ]; then
+ echo "UNABLE TO DETERMINE geckodriver VERSIONS"
+ exit 1
+fi
+mkdir -p ".geckodriver"
+cp "node_modules/geckodriver/geckodriver.tar.gz" .geckodriver/geckodriver.tar.gz
+echo "$geckodriverPkgVersion" > .geckodriver/pkgVersion
+
+echo "Creating bootstrap_cache archive"
+
+# archive cacheable directories
+mkdir -p "$HOME/.kibana/bootstrap_cache"
+tar -cf "$HOME/.kibana/bootstrap_cache/$branch.tar" \
+ x-pack/plugins/reporting/.chromium \
+ .es \
+ .chromedriver \
+ .geckodriver;
+
+echo "Adding node_modules"
+# Find all of the node_modules directories that aren't test fixtures, and aren't inside other node_modules directories, and append them to the tar
+find . -type d -name node_modules -not -path '*__fixtures__*' -prune -print0 | xargs -0I % tar -rf "$HOME/.kibana/bootstrap_cache/$branch.tar" "%"
+
+echo "created $HOME/.kibana/bootstrap_cache/$branch.tar"
+
+if [[ "$branch" != "master" ]]; then
+ rm --preserve-root -rf "$checkoutDir"
+fi
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.irequesttypesmap.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.irequesttypesmap.md
index a9bb8f1eb9d6df..3f5e4ba0f77999 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.irequesttypesmap.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.irequesttypesmap.md
@@ -4,6 +4,8 @@
## IRequestTypesMap interface
+The map of search strategy IDs to the corresponding request type definitions.
+
Signature:
```typescript
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iresponsetypesmap.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iresponsetypesmap.md
index fe5fa0a5d3a331..629ab4347eda80 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iresponsetypesmap.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iresponsetypesmap.md
@@ -4,6 +4,8 @@
## IResponseTypesMap interface
+The map of search strategy IDs to the corresponding response type definitions.
+
Signature:
```typescript
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearch.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearch.md
index 6e037f5161b532..96991579c17169 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearch.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearch.md
@@ -7,5 +7,5 @@
Signature:
```typescript
-export declare type ISearch = (request: IRequestTypesMap[T], options?: ISearchOptions) => Promise;
+export declare type ISearch = (context: RequestHandlerContext, request: IRequestTypesMap[T], options?: ISearchOptions) => Promise;
```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcancel.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcancel.md
index 99c30515e8da6a..b5a687d1b19d84 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcancel.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcancel.md
@@ -7,5 +7,5 @@
Signature:
```typescript
-export declare type ISearchCancel = (id: string) => Promise;
+export declare type ISearchCancel = (context: RequestHandlerContext, id: string) => Promise;
```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcontext.config_.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcontext.config_.md
deleted file mode 100644
index 364d44dba758af..00000000000000
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcontext.config_.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ISearchContext](./kibana-plugin-plugins-data-server.isearchcontext.md) > [config$](./kibana-plugin-plugins-data-server.isearchcontext.config_.md)
-
-## ISearchContext.config$ property
-
-Signature:
-
-```typescript
-config$: Observable;
-```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcontext.core.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcontext.core.md
deleted file mode 100644
index 9d571c25d94bd5..00000000000000
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcontext.core.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ISearchContext](./kibana-plugin-plugins-data-server.isearchcontext.md) > [core](./kibana-plugin-plugins-data-server.isearchcontext.core.md)
-
-## ISearchContext.core property
-
-Signature:
-
-```typescript
-core: CoreSetup;
-```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcontext.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcontext.md
deleted file mode 100644
index 1c3c5ec78f894e..00000000000000
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcontext.md
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ISearchContext](./kibana-plugin-plugins-data-server.isearchcontext.md)
-
-## ISearchContext interface
-
-Signature:
-
-```typescript
-export interface ISearchContext
-```
-
-## Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [config$](./kibana-plugin-plugins-data-server.isearchcontext.config_.md) | Observable<SharedGlobalConfig>
| |
-| [core](./kibana-plugin-plugins-data-server.isearchcontext.core.md) | CoreSetup
| |
-
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.md
index 0319048f4418bc..49412fc42d3b5f 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.md
@@ -14,5 +14,5 @@ export interface ISearchOptions
| Property | Type | Description |
| --- | --- | --- |
-| [signal](./kibana-plugin-plugins-data-server.isearchoptions.signal.md) | AbortSignal
| |
+| [signal](./kibana-plugin-plugins-data-server.isearchoptions.signal.md) | AbortSignal
| An AbortSignal
that allows the caller of search
to abort a search request. |
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.signal.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.signal.md
index 7da5c182b2e0f7..948dfd66da7a03 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.signal.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.signal.md
@@ -4,6 +4,8 @@
## ISearchOptions.signal property
+An `AbortSignal` that allows the caller of `search` to abort a search request.
+
Signature:
```typescript
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchsetup.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchsetup.md
new file mode 100644
index 00000000000000..93e253b2e98a3f
--- /dev/null
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchsetup.md
@@ -0,0 +1,18 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ISearchSetup](./kibana-plugin-plugins-data-server.isearchsetup.md)
+
+## ISearchSetup interface
+
+Signature:
+
+```typescript
+export interface ISearchSetup
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [registerSearchStrategy](./kibana-plugin-plugins-data-server.isearchsetup.registersearchstrategy.md) | TRegisterSearchStrategy
| Extension point exposed for other plugins to register their own search strategies. |
+
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchsetup.registersearchstrategy.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchsetup.registersearchstrategy.md
new file mode 100644
index 00000000000000..c06b8b00806bfe
--- /dev/null
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchsetup.registersearchstrategy.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ISearchSetup](./kibana-plugin-plugins-data-server.isearchsetup.md) > [registerSearchStrategy](./kibana-plugin-plugins-data-server.isearchsetup.registersearchstrategy.md)
+
+## ISearchSetup.registerSearchStrategy property
+
+Extension point exposed for other plugins to register their own search strategies.
+
+Signature:
+
+```typescript
+registerSearchStrategy: TRegisterSearchStrategy;
+```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchstart.getsearchstrategy.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchstart.getsearchstrategy.md
new file mode 100644
index 00000000000000..0ba4bf578d6cc9
--- /dev/null
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchstart.getsearchstrategy.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ISearchStart](./kibana-plugin-plugins-data-server.isearchstart.md) > [getSearchStrategy](./kibana-plugin-plugins-data-server.isearchstart.getsearchstrategy.md)
+
+## ISearchStart.getSearchStrategy property
+
+Get other registered search strategies. For example, if a new strategy needs to use the already-registered ES search strategy, it can use this function to accomplish that.
+
+Signature:
+
+```typescript
+getSearchStrategy: TGetSearchStrategy;
+```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchstart.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchstart.md
new file mode 100644
index 00000000000000..abe72396f61e18
--- /dev/null
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchstart.md
@@ -0,0 +1,18 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ISearchStart](./kibana-plugin-plugins-data-server.isearchstart.md)
+
+## ISearchStart interface
+
+Signature:
+
+```typescript
+export interface ISearchStart
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [getSearchStrategy](./kibana-plugin-plugins-data-server.isearchstart.getsearchstrategy.md) | TGetSearchStrategy
| Get other registered search strategies. For example, if a new strategy needs to use the already-registered ES search strategy, it can use this function to accomplish that. |
+
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchstrategy.cancel.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchstrategy.cancel.md
new file mode 100644
index 00000000000000..c1e0c3d9f23300
--- /dev/null
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchstrategy.cancel.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ISearchStrategy](./kibana-plugin-plugins-data-server.isearchstrategy.md) > [cancel](./kibana-plugin-plugins-data-server.isearchstrategy.cancel.md)
+
+## ISearchStrategy.cancel property
+
+Signature:
+
+```typescript
+cancel?: ISearchCancel;
+```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchstrategy.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchstrategy.md
new file mode 100644
index 00000000000000..167c6ab6e5a16f
--- /dev/null
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchstrategy.md
@@ -0,0 +1,21 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ISearchStrategy](./kibana-plugin-plugins-data-server.isearchstrategy.md)
+
+## ISearchStrategy interface
+
+Search strategy interface contains a search method that takes in a request and returns a promise that resolves to a response.
+
+Signature:
+
+```typescript
+export interface ISearchStrategy
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [cancel](./kibana-plugin-plugins-data-server.isearchstrategy.cancel.md) | ISearchCancel<T>
| |
+| [search](./kibana-plugin-plugins-data-server.isearchstrategy.search.md) | ISearch<T>
| |
+
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchstrategy.search.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchstrategy.search.md
new file mode 100644
index 00000000000000..34a17ca87807a4
--- /dev/null
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchstrategy.search.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ISearchStrategy](./kibana-plugin-plugins-data-server.isearchstrategy.md) > [search](./kibana-plugin-plugins-data-server.isearchstrategy.search.md)
+
+## ISearchStrategy.search property
+
+Signature:
+
+```typescript
+search: ISearch;
+```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md
index 0efbe8ed4ed643..f492ba2843a697 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md
@@ -39,10 +39,12 @@
| [IIndexPattern](./kibana-plugin-plugins-data-server.iindexpattern.md) | |
| [IndexPatternAttributes](./kibana-plugin-plugins-data-server.indexpatternattributes.md) | Use data plugin interface instead |
| [IndexPatternFieldDescriptor](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.md) | |
-| [IRequestTypesMap](./kibana-plugin-plugins-data-server.irequesttypesmap.md) | |
-| [IResponseTypesMap](./kibana-plugin-plugins-data-server.iresponsetypesmap.md) | |
-| [ISearchContext](./kibana-plugin-plugins-data-server.isearchcontext.md) | |
+| [IRequestTypesMap](./kibana-plugin-plugins-data-server.irequesttypesmap.md) | The map of search strategy IDs to the corresponding request type definitions. |
+| [IResponseTypesMap](./kibana-plugin-plugins-data-server.iresponsetypesmap.md) | The map of search strategy IDs to the corresponding response type definitions. |
| [ISearchOptions](./kibana-plugin-plugins-data-server.isearchoptions.md) | |
+| [ISearchSetup](./kibana-plugin-plugins-data-server.isearchsetup.md) | |
+| [ISearchStart](./kibana-plugin-plugins-data-server.isearchstart.md) | |
+| [ISearchStrategy](./kibana-plugin-plugins-data-server.isearchstrategy.md) | Search strategy interface contains a search method that takes in a request and returns a promise that resolves to a response. |
| [KueryNode](./kibana-plugin-plugins-data-server.kuerynode.md) | |
| [PluginSetup](./kibana-plugin-plugins-data-server.pluginsetup.md) | |
| [PluginStart](./kibana-plugin-plugins-data-server.pluginstart.md) | |
@@ -73,5 +75,5 @@
| [ISearch](./kibana-plugin-plugins-data-server.isearch.md) | |
| [ISearchCancel](./kibana-plugin-plugins-data-server.isearchcancel.md) | |
| [ParsedInterval](./kibana-plugin-plugins-data-server.parsedinterval.md) | |
-| [TSearchStrategyProvider](./kibana-plugin-plugins-data-server.tsearchstrategyprovider.md) | Search strategy provider creates an instance of a search strategy with the request handler context bound to it. This way every search strategy can use whatever information they require from the request context. |
+| [TStrategyTypes](./kibana-plugin-plugins-data-server.tstrategytypes.md) | Contains all known strategy type identifiers that will be used to map to request and response shapes. Plugins that wish to add their own custom search strategies should extend this type via:const MY\_STRATEGY = 'MY\_STRATEGY';declare module 'src/plugins/search/server' { export interface IRequestTypesMap { \[MY\_STRATEGY\]: IMySearchRequest; }export interface IResponseTypesMap { \[MY\_STRATEGY\]: IMySearchResponse } } |
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.setup.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.setup.md
index bd617990a00a2f..13c69d6bf7548e 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.setup.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.setup.md
@@ -7,11 +7,11 @@
Signature:
```typescript
-setup(core: CoreSetup, { usageCollection }: DataPluginSetupDependencies): {
+setup(core: CoreSetup