diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchrequest.indextype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchrequest.indextype.md
deleted file mode 100644
index 55b43efc52305..0000000000000
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchrequest.indextype.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IEsSearchRequest](./kibana-plugin-plugins-data-public.iessearchrequest.md) > [indexType](./kibana-plugin-plugins-data-public.iessearchrequest.indextype.md)
-
-## IEsSearchRequest.indexType property
-
-Signature:
-
-```typescript
-indexType?: string;
-```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchrequest.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchrequest.md
index 45cd088ee1203..d8b10b5e9f76f 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchrequest.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchrequest.md
@@ -2,17 +2,10 @@
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IEsSearchRequest](./kibana-plugin-plugins-data-public.iessearchrequest.md)
-## IEsSearchRequest interface
+## IEsSearchRequest type
Signature:
```typescript
-export interface IEsSearchRequest extends IKibanaSearchRequest
+export declare type IEsSearchRequest = IKibanaSearchRequest;
```
-
-## Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [indexType](./kibana-plugin-plugins-data-public.iessearchrequest.indextype.md) | string
| |
-
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md
index 7f5a042e0ab81..46b8e30326fea 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md
@@ -64,7 +64,6 @@
| [EsQueryConfig](./kibana-plugin-plugins-data-public.esqueryconfig.md) | |
| [FieldFormatConfig](./kibana-plugin-plugins-data-public.fieldformatconfig.md) | |
| [IDataPluginServices](./kibana-plugin-plugins-data-public.idatapluginservices.md) | |
-| [IEsSearchRequest](./kibana-plugin-plugins-data-public.iessearchrequest.md) | |
| [IFieldSubType](./kibana-plugin-plugins-data-public.ifieldsubtype.md) | |
| [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) | |
| [IIndexPattern](./kibana-plugin-plugins-data-public.iindexpattern.md) | |
@@ -164,6 +163,7 @@
| [IAggConfig](./kibana-plugin-plugins-data-public.iaggconfig.md) | AggConfig This class represents an aggregation, which is displayed in the left-hand nav of the Visualize app. |
| [IAggType](./kibana-plugin-plugins-data-public.iaggtype.md) | |
| [IEsError](./kibana-plugin-plugins-data-public.ieserror.md) | |
+| [IEsSearchRequest](./kibana-plugin-plugins-data-public.iessearchrequest.md) | |
| [IEsSearchResponse](./kibana-plugin-plugins-data-public.iessearchresponse.md) | |
| [IFieldFormat](./kibana-plugin-plugins-data-public.ifieldformat.md) | |
| [IFieldFormatsRegistry](./kibana-plugin-plugins-data-public.ifieldformatsregistry.md) | |
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchrequest.indextype.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchrequest.indextype.md
deleted file mode 100644
index aaf4e55ee007b..0000000000000
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchrequest.indextype.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IEsSearchRequest](./kibana-plugin-plugins-data-server.iessearchrequest.md) > [indexType](./kibana-plugin-plugins-data-server.iessearchrequest.indextype.md)
-
-## IEsSearchRequest.indexType property
-
-Signature:
-
-```typescript
-indexType?: string;
-```
diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchrequest.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchrequest.md
index 9141bcdd2e8d7..e326ff5773da3 100644
--- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchrequest.md
+++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iessearchrequest.md
@@ -2,17 +2,10 @@
[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IEsSearchRequest](./kibana-plugin-plugins-data-server.iessearchrequest.md)
-## IEsSearchRequest interface
+## IEsSearchRequest type
Signature:
```typescript
-export interface IEsSearchRequest extends IKibanaSearchRequest
+export declare type IEsSearchRequest = IKibanaSearchRequest;
```
-
-## Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [indexType](./kibana-plugin-plugins-data-server.iessearchrequest.indextype.md) | string
| |
-
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 b1745b298e27e..184390787b1ae 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
@@ -50,7 +50,6 @@
| [EsQueryConfig](./kibana-plugin-plugins-data-server.esqueryconfig.md) | |
| [FieldDescriptor](./kibana-plugin-plugins-data-server.fielddescriptor.md) | |
| [FieldFormatConfig](./kibana-plugin-plugins-data-server.fieldformatconfig.md) | |
-| [IEsSearchRequest](./kibana-plugin-plugins-data-server.iessearchrequest.md) | |
| [IFieldSubType](./kibana-plugin-plugins-data-server.ifieldsubtype.md) | |
| [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) | |
| [IndexPatternAttributes](./kibana-plugin-plugins-data-server.indexpatternattributes.md) | Interface for an index pattern saved object |
@@ -103,6 +102,7 @@
| [Filter](./kibana-plugin-plugins-data-server.filter.md) | |
| [IAggConfig](./kibana-plugin-plugins-data-server.iaggconfig.md) | AggConfig This class represents an aggregation, which is displayed in the left-hand nav of the Visualize app. |
| [IAggType](./kibana-plugin-plugins-data-server.iaggtype.md) | |
+| [IEsSearchRequest](./kibana-plugin-plugins-data-server.iessearchrequest.md) | |
| [IEsSearchResponse](./kibana-plugin-plugins-data-server.iessearchresponse.md) | |
| [IFieldFormatsRegistry](./kibana-plugin-plugins-data-server.ifieldformatsregistry.md) | |
| [IFieldParamType](./kibana-plugin-plugins-data-server.ifieldparamtype.md) | |
diff --git a/src/plugins/data/common/search/index.ts b/src/plugins/data/common/search/index.ts
index badbb94e9752f..7c454c11e00a3 100644
--- a/src/plugins/data/common/search/index.ts
+++ b/src/plugins/data/common/search/index.ts
@@ -17,3 +17,4 @@ export * from './poll_search';
export * from './strategies/es_search';
export * from './strategies/eql_search';
export * from './strategies/ese_search';
+export * from './strategies/rollup_search';
diff --git a/src/plugins/data/common/search/search_source/search_source.test.ts b/src/plugins/data/common/search/search_source/search_source.test.ts
index 7c0473077d182..1cb793effb5a0 100644
--- a/src/plugins/data/common/search/search_source/search_source.test.ts
+++ b/src/plugins/data/common/search/search_source/search_source.test.ts
@@ -10,7 +10,12 @@ import { of } from 'rxjs';
import { IndexPattern } from '../../index_patterns';
import { GetConfigFn } from '../../types';
import { SearchSource, SearchSourceDependencies, SortDirection } from './';
-import { AggConfigs, AggTypesRegistryStart, ES_SEARCH_STRATEGY } from '../../';
+import {
+ AggConfigs,
+ AggTypesRegistryStart,
+ ES_SEARCH_STRATEGY,
+ ROLLUP_SEARCH_STRATEGY,
+} from '../../';
import { mockAggTypesRegistry } from '../aggs/test_helpers';
import { RequestResponder } from 'src/plugins/inspector/common';
import { switchMap } from 'rxjs/operators';
@@ -32,6 +37,14 @@ const indexPattern = ({
getSourceFiltering: () => mockSource,
} as unknown) as IndexPattern;
+const rollupIndexPattern = ({
+ title: 'foo',
+ type: 'rollup',
+ fields: [{ name: 'foo-bar' }, { name: 'field1' }, { name: 'field2' }],
+ getComputedFields,
+ getSourceFiltering: () => mockSource,
+} as unknown) as IndexPattern;
+
const indexPattern2 = ({
title: 'foo',
getComputedFields,
@@ -917,6 +930,44 @@ describe('SearchSource', () => {
const [, callOptions] = mockSearchMethod.mock.calls[0];
expect(callOptions.strategy).toBe('banana');
});
+
+ test('should use rollup search if rollup index', async () => {
+ searchSource = new SearchSource({ index: rollupIndexPattern }, searchSourceDependencies);
+ const options = {};
+ await searchSource.fetch$(options).toPromise();
+
+ const [, callOptions] = mockSearchMethod.mock.calls[0];
+ expect(callOptions.strategy).toBe(ROLLUP_SEARCH_STRATEGY);
+ });
+
+ test('should not use rollup search if overriden', async () => {
+ searchSource = new SearchSource({ index: rollupIndexPattern }, searchSourceDependencies);
+ const options = { strategy: 'banana' };
+ await searchSource.fetch$(options).toPromise();
+
+ const [, callOptions] = mockSearchMethod.mock.calls[0];
+ expect(callOptions.strategy).toBe('banana');
+ });
+ });
+
+ describe('Rollup search', () => {
+ test('should use rollup search if rollup index', async () => {
+ searchSource = new SearchSource({ index: rollupIndexPattern }, searchSourceDependencies);
+ const options = {};
+ await searchSource.fetch$(options).toPromise();
+
+ const [, callOptions] = mockSearchMethod.mock.calls[0];
+ expect(callOptions.strategy).toBe(ROLLUP_SEARCH_STRATEGY);
+ });
+
+ test('should not use rollup search if overriden', async () => {
+ searchSource = new SearchSource({ index: rollupIndexPattern }, searchSourceDependencies);
+ const options = { strategy: 'banana' };
+ await searchSource.fetch$(options).toPromise();
+
+ const [, callOptions] = mockSearchMethod.mock.calls[0];
+ expect(callOptions.strategy).toBe('banana');
+ });
});
describe('responses', () => {
diff --git a/src/plugins/data/common/search/search_source/search_source.ts b/src/plugins/data/common/search/search_source/search_source.ts
index f35d2d47f1bf4..7600d553403c3 100644
--- a/src/plugins/data/common/search/search_source/search_source.ts
+++ b/src/plugins/data/common/search/search_source/search_source.ts
@@ -96,6 +96,7 @@ import {
} from '../../../common';
import { getHighlightRequest } from '../../../common/field_formats';
import { extractReferences } from './extract_references';
+import { ROLLUP_SEARCH_STRATEGY } from '../strategies/rollup_search';
/** @internal */
export const searchSourceRequiredUiSettings = [
@@ -276,10 +277,11 @@ export class SearchSource {
): Observable>> {
const { getConfig } = this.dependencies;
const syncSearchByDefault = getConfig(UI_SETTINGS.COURIER_BATCH_SEARCHES);
+ const hasExplicitStrategy = !!options.strategy;
// Use the sync search strategy if legacy search is enabled.
// This still uses bfetch for batching.
- if (!options?.strategy && syncSearchByDefault) {
+ if (!hasExplicitStrategy && syncSearchByDefault) {
options.strategy = ES_SEARCH_STRATEGY;
}
@@ -289,6 +291,9 @@ export class SearchSource {
this.history = [searchRequest];
if (searchRequest.index) {
options.indexPattern = searchRequest.index;
+ if (searchRequest.indexType === 'rollup' && !hasExplicitStrategy) {
+ options.strategy = ROLLUP_SEARCH_STRATEGY;
+ }
}
return this.fetchSearch$(searchRequest, options);
@@ -445,7 +450,7 @@ export class SearchSource {
getConfig,
});
- return search({ params, indexType: searchRequest.indexType }, options).pipe(
+ return search({ params }, options).pipe(
switchMap((response) => {
return new Observable>((obs) => {
if (isErrorResponse(response)) {
diff --git a/src/plugins/data/common/search/strategies/es_search/types.ts b/src/plugins/data/common/search/strategies/es_search/types.ts
index 05df661d466c8..eb046e61c94f5 100644
--- a/src/plugins/data/common/search/strategies/es_search/types.ts
+++ b/src/plugins/data/common/search/strategies/es_search/types.ts
@@ -15,8 +15,6 @@ export type ISearchRequestParams = {
trackTotalHits?: boolean;
} & estypes.SearchRequest;
-export interface IEsSearchRequest extends IKibanaSearchRequest {
- indexType?: string;
-}
+export type IEsSearchRequest = IKibanaSearchRequest;
export type IEsSearchResponse