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 bf29c883e4eb9..fc0dab94a0f65 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
@@ -88,6 +88,7 @@
| [SavedQuery](./kibana-plugin-plugins-data-public.savedquery.md) | |
| [SavedQueryService](./kibana-plugin-plugins-data-public.savedqueryservice.md) | |
| [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) | |
+| [SearchStrategyProvider](./kibana-plugin-plugins-data-public.searchstrategyprovider.md) | |
| [TabbedAggColumn](./kibana-plugin-plugins-data-public.tabbedaggcolumn.md) | \* |
| [TabbedTable](./kibana-plugin-plugins-data-public.tabbedtable.md) | \* |
| [TimeRange](./kibana-plugin-plugins-data-public.timerange.md) | |
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.id.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.id.md
new file mode 100644
index 0000000000000..d60ffba6a05ca
--- /dev/null
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.id.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchStrategyProvider](./kibana-plugin-plugins-data-public.searchstrategyprovider.md) > [id](./kibana-plugin-plugins-data-public.searchstrategyprovider.id.md)
+
+## SearchStrategyProvider.id property
+
+Signature:
+
+```typescript
+id: string;
+```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.isviable.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.isviable.md
new file mode 100644
index 0000000000000..aa8ed49051ee9
--- /dev/null
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.isviable.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchStrategyProvider](./kibana-plugin-plugins-data-public.searchstrategyprovider.md) > [isViable](./kibana-plugin-plugins-data-public.searchstrategyprovider.isviable.md)
+
+## SearchStrategyProvider.isViable property
+
+Signature:
+
+```typescript
+isViable: (indexPattern: IndexPattern) => boolean;
+```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.md
new file mode 100644
index 0000000000000..b271a921906a7
--- /dev/null
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.md
@@ -0,0 +1,20 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchStrategyProvider](./kibana-plugin-plugins-data-public.searchstrategyprovider.md)
+
+## SearchStrategyProvider interface
+
+Signature:
+
+```typescript
+export interface SearchStrategyProvider
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [id](./kibana-plugin-plugins-data-public.searchstrategyprovider.id.md) | string
| |
+| [isViable](./kibana-plugin-plugins-data-public.searchstrategyprovider.isviable.md) | (indexPattern: IndexPattern) => boolean
| |
+| [search](./kibana-plugin-plugins-data-public.searchstrategyprovider.search.md) | (params: SearchStrategySearchParams) => SearchStrategyResponse
| |
+
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.search.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.search.md
new file mode 100644
index 0000000000000..6e2561c3b0ad0
--- /dev/null
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.search.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchStrategyProvider](./kibana-plugin-plugins-data-public.searchstrategyprovider.md) > [search](./kibana-plugin-plugins-data-public.searchstrategyprovider.search.md)
+
+## SearchStrategyProvider.search property
+
+Signature:
+
+```typescript
+search: (params: SearchStrategySearchParams) => SearchStrategyResponse;
+```
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/get_indices.test.ts b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/get_indices.test.ts
index b1500f8303b66..40583af7177fe 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/get_indices.test.ts
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/lib/get_indices.test.ts
@@ -20,7 +20,7 @@
import { getIndices } from './get_indices';
import { IndexPatternCreationConfig } from '../../../../../../../../../plugins/index_pattern_management/public';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { LegacyApiCaller } from '../../../../../../../../../plugins/data/public/search/legacy';
+import { LegacyApiCaller } from '../../../../../../../../../plugins/data/public/search';
export const successfulResponse = {
hits: {
diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts
index b62b728beca35..06a46065baa84 100644
--- a/src/plugins/data/public/index.ts
+++ b/src/plugins/data/public/index.ts
@@ -363,6 +363,7 @@ export {
SearchRequest,
SearchResponse,
SearchError,
+ SearchStrategyProvider,
ISearchSource,
SearchSource,
createSearchSource,
diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md
index 78659720fe09a..7d902c88616c5 100644
--- a/src/plugins/data/public/public.api.md
+++ b/src/plugins/data/public/public.api.md
@@ -1736,6 +1736,21 @@ export interface SearchSourceFields {
version?: boolean;
}
+// Warning: (ae-missing-release-tag) "SearchStrategyProvider" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
+//
+// @public (undocumented)
+export interface SearchStrategyProvider {
+ // (undocumented)
+ id: string;
+ // (undocumented)
+ isViable: (indexPattern: IndexPattern) => boolean;
+ // Warning: (ae-forgotten-export) The symbol "SearchStrategySearchParams" needs to be exported by the entry point index.d.ts
+ // Warning: (ae-forgotten-export) The symbol "SearchStrategyResponse" needs to be exported by the entry point index.d.ts
+ //
+ // (undocumented)
+ search: (params: SearchStrategySearchParams) => SearchStrategyResponse;
+}
+
// Warning: (ae-missing-release-tag) "SortDirection" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
@@ -1886,21 +1901,21 @@ export type TSearchStrategyProvider = (context: ISearc
// src/plugins/data/public/index.ts:234:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:234:27 - (ae-forgotten-export) The symbol "getRoutes" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:234:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:382:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:382:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:382:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:382:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:387:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:388:1 - (ae-forgotten-export) The symbol "convertDateRangeToString" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:390:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:399:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:400:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:401:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:404:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:405:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:408:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:409:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
-// src/plugins/data/public/index.ts:412:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:383:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:383:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:383:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:383:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:388:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:389:1 - (ae-forgotten-export) The symbol "convertDateRangeToString" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:391:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:400:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:401:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:402:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:405:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:406:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:409:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:410:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
+// src/plugins/data/public/index.ts:413:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:33:33 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:37:1 - (ae-forgotten-export) The symbol "QueryStateChange" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/types.ts:52:5 - (ae-forgotten-export) The symbol "createFiltersFromEvent" needs to be exported by the entry point index.d.ts
diff --git a/src/plugins/data/public/search/aggs/test_helpers/mock_data_services.ts b/src/plugins/data/public/search/aggs/test_helpers/mock_data_services.ts
index e807e084c683a..d1d591771743c 100644
--- a/src/plugins/data/public/search/aggs/test_helpers/mock_data_services.ts
+++ b/src/plugins/data/public/search/aggs/test_helpers/mock_data_services.ts
@@ -18,8 +18,8 @@
*/
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { coreMock } from '../../../../../../core/public/mocks';
-import { dataPluginMock } from '../../../mocks';
+import { coreMock } from '../../../../../../../src/core/public/mocks';
+import { dataPluginMock } from '../../../../public/mocks';
import {
setFieldFormats,
setIndexPatterns,
@@ -29,7 +29,7 @@ import {
setQueryService,
setSearchService,
setUiSettings,
-} from '../../../services';
+} from '../../../../public/services';
/**
* Testing helper which calls all of the service setters used in the
@@ -49,9 +49,4 @@ export function mockDataServices() {
setQueryService(data.query);
setSearchService(data.search);
setUiSettings(core.uiSettings);
-
- return {
- core,
- data,
- };
}
diff --git a/src/plugins/data/public/search/legacy/es_client/get_es_client.ts b/src/plugins/data/public/search/es_client/get_es_client.ts
similarity index 100%
rename from src/plugins/data/public/search/legacy/es_client/get_es_client.ts
rename to src/plugins/data/public/search/es_client/get_es_client.ts
diff --git a/src/plugins/data/public/search/legacy/es_client/index.ts b/src/plugins/data/public/search/es_client/index.ts
similarity index 91%
rename from src/plugins/data/public/search/legacy/es_client/index.ts
rename to src/plugins/data/public/search/es_client/index.ts
index 78ac83af642d8..b1e0ce3116824 100644
--- a/src/plugins/data/public/search/legacy/es_client/index.ts
+++ b/src/plugins/data/public/search/es_client/index.ts
@@ -18,4 +18,4 @@
*/
export { getEsClient } from './get_es_client';
-export { LegacyApiCaller } from './types';
+export { SearchRequest, SearchResponse, LegacyApiCaller } from './types';
diff --git a/src/plugins/data/public/search/legacy/es_client/types.ts b/src/plugins/data/public/search/es_client/types.ts
similarity index 94%
rename from src/plugins/data/public/search/legacy/es_client/types.ts
rename to src/plugins/data/public/search/es_client/types.ts
index 7a56b9b0cb00a..3ca0513a14238 100644
--- a/src/plugins/data/public/search/legacy/es_client/types.ts
+++ b/src/plugins/data/public/search/es_client/types.ts
@@ -17,7 +17,8 @@
* under the License.
*/
-import { SearchRequest, SearchResponse } from '../../fetch';
+export type SearchRequest = any;
+export type SearchResponse = any;
export interface LegacyApiCaller {
search: (searchRequest: SearchRequest) => LegacyApiCallerResponse;
diff --git a/src/plugins/data/public/search/legacy/call_client.test.ts b/src/plugins/data/public/search/fetch/call_client.test.ts
similarity index 91%
rename from src/plugins/data/public/search/legacy/call_client.test.ts
rename to src/plugins/data/public/search/fetch/call_client.test.ts
index f919187d46784..7a99b7c064515 100644
--- a/src/plugins/data/public/search/legacy/call_client.test.ts
+++ b/src/plugins/data/public/search/fetch/call_client.test.ts
@@ -18,17 +18,16 @@
*/
import { callClient } from './call_client';
-import { SearchStrategySearchParams } from './types';
-import { defaultSearchStrategy } from './default_search_strategy';
-import { FetchHandlers } from '../fetch';
-import { handleResponse } from '../fetch/handle_response';
+import { handleResponse } from './handle_response';
+import { FetchHandlers } from './types';
+import { SearchStrategySearchParams, defaultSearchStrategy } from '../search_strategy';
const mockAbortFn = jest.fn();
-jest.mock('../fetch/handle_response', () => ({
+jest.mock('./handle_response', () => ({
handleResponse: jest.fn((request, response) => response),
}));
-jest.mock('./default_search_strategy', () => {
+jest.mock('../search_strategy', () => {
return {
defaultSearchStrategy: {
search: jest.fn(({ searchRequests }: SearchStrategySearchParams) => {
diff --git a/src/plugins/data/public/search/legacy/call_client.ts b/src/plugins/data/public/search/fetch/call_client.ts
similarity index 89%
rename from src/plugins/data/public/search/legacy/call_client.ts
rename to src/plugins/data/public/search/fetch/call_client.ts
index c484c46aa4879..b3c4c682fa60c 100644
--- a/src/plugins/data/public/search/legacy/call_client.ts
+++ b/src/plugins/data/public/search/fetch/call_client.ts
@@ -17,9 +17,10 @@
* under the License.
*/
-import { FetchOptions, FetchHandlers, handleResponse } from '../fetch';
-import { defaultSearchStrategy } from './default_search_strategy';
-import { SearchRequest } from '../index';
+import { handleResponse } from './handle_response';
+import { FetchOptions, FetchHandlers } from './types';
+import { defaultSearchStrategy } from '../search_strategy';
+import { SearchRequest } from '..';
export function callClient(
searchRequests: SearchRequest[],
diff --git a/src/plugins/data/public/search/fetch/request_error.ts b/src/plugins/data/public/search/fetch/errors.ts
similarity index 100%
rename from src/plugins/data/public/search/fetch/request_error.ts
rename to src/plugins/data/public/search/fetch/errors.ts
diff --git a/src/plugins/data/public/search/legacy/fetch_soon.test.ts b/src/plugins/data/public/search/fetch/fetch_soon.test.ts
similarity index 96%
rename from src/plugins/data/public/search/legacy/fetch_soon.test.ts
rename to src/plugins/data/public/search/fetch/fetch_soon.test.ts
index b2e17798ccc9f..a8d593c8501f6 100644
--- a/src/plugins/data/public/search/legacy/fetch_soon.test.ts
+++ b/src/plugins/data/public/search/fetch/fetch_soon.test.ts
@@ -19,9 +19,9 @@
import { fetchSoon } from './fetch_soon';
import { callClient } from './call_client';
-import { IUiSettingsClient } from 'kibana/public';
-import { FetchHandlers, FetchOptions } from '../fetch/types';
-import { SearchRequest, SearchResponse } from '../index';
+import { IUiSettingsClient } from '../../../../../core/public';
+import { FetchHandlers, FetchOptions } from './types';
+import { SearchRequest, SearchResponse } from '..';
function getConfigStub(config: any = {}) {
return {
diff --git a/src/plugins/data/public/search/legacy/fetch_soon.ts b/src/plugins/data/public/search/fetch/fetch_soon.ts
similarity index 95%
rename from src/plugins/data/public/search/legacy/fetch_soon.ts
rename to src/plugins/data/public/search/fetch/fetch_soon.ts
index 18fa410a5bef0..b1405747426ee 100644
--- a/src/plugins/data/public/search/legacy/fetch_soon.ts
+++ b/src/plugins/data/public/search/fetch/fetch_soon.ts
@@ -18,8 +18,8 @@
*/
import { callClient } from './call_client';
-import { FetchHandlers, FetchOptions } from '../fetch/types';
-import { SearchRequest, SearchResponse } from '../index';
+import { FetchHandlers, FetchOptions } from './types';
+import { SearchRequest, SearchResponse } from '..';
/**
* This function introduces a slight delay in the request process to allow multiple requests to queue
diff --git a/src/plugins/data/public/search/fetch/get_search_params.test.ts b/src/plugins/data/public/search/fetch/get_search_params.test.ts
deleted file mode 100644
index edf18405e8ff7..0000000000000
--- a/src/plugins/data/public/search/fetch/get_search_params.test.ts
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import { getSearchParams } from './get_search_params';
-import { IUiSettingsClient } from 'kibana/public';
-
-function getConfigStub(config: any = {}) {
- return {
- get: key => config[key],
- } as IUiSettingsClient;
-}
-
-describe('getSearchParams', () => {
- test('includes rest_total_hits_as_int', () => {
- const config = getConfigStub();
- const searchParams = getSearchParams(config);
- expect(searchParams.rest_total_hits_as_int).toBe(true);
- });
-
- test('includes ignore_unavailable', () => {
- const config = getConfigStub();
- const searchParams = getSearchParams(config);
- expect(searchParams.ignore_unavailable).toBe(true);
- });
-
- test('includes ignore_throttled according to search:includeFrozen', () => {
- let config = getConfigStub({ 'search:includeFrozen': true });
- let searchParams = getSearchParams(config);
- expect(searchParams.ignore_throttled).toBe(false);
-
- config = getConfigStub({ 'search:includeFrozen': false });
- searchParams = getSearchParams(config);
- expect(searchParams.ignore_throttled).toBe(true);
- });
-
- test('includes max_concurrent_shard_requests according to courier:maxConcurrentShardRequests', () => {
- let config = getConfigStub({ 'courier:maxConcurrentShardRequests': 0 });
- let searchParams = getSearchParams(config);
- expect(searchParams.max_concurrent_shard_requests).toBe(undefined);
-
- config = getConfigStub({ 'courier:maxConcurrentShardRequests': 5 });
- searchParams = getSearchParams(config);
- expect(searchParams.max_concurrent_shard_requests).toBe(5);
- });
-
- test('includes timeout according to esShardTimeout if greater than 0', () => {
- const config = getConfigStub();
- let searchParams = getSearchParams(config, 0);
- expect(searchParams.timeout).toBe(undefined);
-
- searchParams = getSearchParams(config, 100);
- expect(searchParams.timeout).toBe('100ms');
- });
-});
diff --git a/src/plugins/data/public/search/fetch/index.ts b/src/plugins/data/public/search/fetch/index.ts
index 39845ec31bfaa..8a80b716add32 100644
--- a/src/plugins/data/public/search/fetch/index.ts
+++ b/src/plugins/data/public/search/fetch/index.ts
@@ -18,14 +18,5 @@
*/
export * from './types';
-export {
- getSearchParams,
- getPreference,
- getTimeout,
- getIgnoreThrottled,
- getMaxConcurrentShardRequests,
-} from './get_search_params';
-
-export { SearchError, getSearchErrorType } from './search_error';
-export { RequestFailure } from './request_error';
-export { handleResponse } from './handle_response';
+export { fetchSoon } from './fetch_soon';
+export { RequestFailure } from './errors';
diff --git a/src/plugins/data/public/search/fetch/types.ts b/src/plugins/data/public/search/fetch/types.ts
index 475b2abbc019f..e8de0576b8a72 100644
--- a/src/plugins/data/public/search/fetch/types.ts
+++ b/src/plugins/data/public/search/fetch/types.ts
@@ -20,9 +20,6 @@
import { IUiSettingsClient } from '../../../../../core/public';
import { ISearchStart } from '../types';
-export type SearchRequest = any;
-export type SearchResponse = any;
-
export interface FetchOptions {
abortSignal?: AbortSignal;
searchStrategyId?: string;
diff --git a/src/plugins/data/public/search/index.ts b/src/plugins/data/public/search/index.ts
index 75c0eb8b6f022..cce973d632f41 100644
--- a/src/plugins/data/public/search/index.ts
+++ b/src/plugins/data/public/search/index.ts
@@ -44,13 +44,9 @@ export { esSearchStrategyProvider, getEsPreference } from './es_search';
export { IKibanaSearchResponse, IKibanaSearchRequest } from '../../common/search';
-export {
- SearchError,
- FetchOptions,
- SearchRequest,
- SearchResponse,
- getSearchErrorType,
-} from './fetch';
+export { LegacyApiCaller, SearchRequest, SearchResponse } from './es_client';
+
+export { SearchError, SearchStrategyProvider, getSearchErrorType } from './search_strategy';
export {
ISearchSource,
@@ -63,3 +59,5 @@ export {
export { SearchInterceptor } from './search_interceptor';
export { RequestTimeoutError } from './request_timeout_error';
+
+export { FetchOptions } from './fetch';
diff --git a/src/plugins/data/public/search/legacy/get_msearch_params.ts b/src/plugins/data/public/search/legacy/get_msearch_params.ts
deleted file mode 100644
index 48d13903c972f..0000000000000
--- a/src/plugins/data/public/search/legacy/get_msearch_params.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import { IUiSettingsClient } from 'kibana/public';
-import { getIgnoreThrottled, getMaxConcurrentShardRequests } from '../fetch';
-
-export function getMSearchParams(config: IUiSettingsClient) {
- return {
- rest_total_hits_as_int: true,
- ignore_throttled: getIgnoreThrottled(config),
- max_concurrent_shard_requests: getMaxConcurrentShardRequests(config),
- };
-}
diff --git a/src/plugins/data/public/search/search_service.ts b/src/plugins/data/public/search/search_service.ts
index 916278a96659b..a539736991adb 100644
--- a/src/plugins/data/public/search/search_service.ts
+++ b/src/plugins/data/public/search/search_service.ts
@@ -22,12 +22,12 @@ import { Plugin, CoreSetup, CoreStart, PackageInfo } from '../../../../core/publ
import { SYNC_SEARCH_STRATEGY, syncSearchStrategyProvider } from './sync_search_strategy';
import { ISearchSetup, ISearchStart, TSearchStrategyProvider, TSearchStrategiesMap } from './types';
import { TStrategyTypes } from './strategy_types';
-import { getEsClient, LegacyApiCaller } from './legacy';
+import { getEsClient, LegacyApiCaller } from './es_client';
import { ES_SEARCH_STRATEGY, DEFAULT_SEARCH_STRATEGY } from '../../common/search';
-import { esSearchStrategyProvider } from './es_search';
+import { esSearchStrategyProvider } from './es_search/es_search_strategy';
import { IndexPatternsContract } from '../index_patterns/index_patterns';
import { createSearchSource } from './search_source';
-import { QuerySetup } from '../query';
+import { QuerySetup } from '../query/query_service';
import { GetInternalStartServicesFn } from '../types';
import { SearchInterceptor } from './search_interceptor';
import {
diff --git a/src/plugins/data/public/search/search_source/search_source.test.ts b/src/plugins/data/public/search/search_source/search_source.test.ts
index 6e878844664ad..6bad093d31402 100644
--- a/src/plugins/data/public/search/search_source/search_source.test.ts
+++ b/src/plugins/data/public/search/search_source/search_source.test.ts
@@ -20,26 +20,8 @@
import { SearchSource } from './search_source';
import { IndexPattern, SortDirection } from '../..';
import { mockDataServices } from '../aggs/test_helpers';
-import { setSearchService } from '../../services';
-import { searchStartMock } from '../mocks';
-import { fetchSoon } from '../legacy';
-import { CoreStart } from 'kibana/public';
-import { Observable } from 'rxjs';
-// Setup search service mock
-searchStartMock.search = jest.fn(() => {
- return new Observable(subscriber => {
- setTimeout(() => {
- subscriber.next({
- rawResponse: '',
- });
- subscriber.complete();
- }, 100);
- });
-}) as any;
-setSearchService(searchStartMock);
-
-jest.mock('../legacy', () => ({
+jest.mock('../fetch', () => ({
fetchSoon: jest.fn().mockResolvedValue({}),
}));
@@ -62,11 +44,8 @@ const indexPattern2 = ({
} as unknown) as IndexPattern;
describe('SearchSource', function() {
- let uiSettingsMock: jest.Mocked;
beforeEach(() => {
- const { core } = mockDataServices();
- uiSettingsMock = core.uiSettings;
- jest.clearAllMocks();
+ mockDataServices();
});
describe('#setField()', function() {
@@ -172,36 +151,6 @@ describe('SearchSource', function() {
});
});
- describe('#legacy fetch()', () => {
- beforeEach(() => {
- uiSettingsMock.get.mockImplementation(() => {
- return true; // batchSearches = true
- });
- });
-
- afterEach(() => {
- uiSettingsMock.get.mockImplementation(() => {
- return false; // batchSearches = false
- });
- });
-
- it('should call msearch', async () => {
- const searchSource = new SearchSource({ index: indexPattern });
- const options = {};
- await searchSource.fetch(options);
- expect(fetchSoon).toBeCalledTimes(1);
- });
- });
-
- describe('#search service fetch()', () => {
- it('should call msearch', async () => {
- const searchSource = new SearchSource({ index: indexPattern });
- const options = {};
- await searchSource.fetch(options);
- expect(searchStartMock.search).toBeCalledTimes(1);
- });
- });
-
describe('#serialize', function() {
it('should reference index patterns', () => {
const indexPattern123 = { id: '123' } as IndexPattern;
diff --git a/src/plugins/data/public/search/search_source/search_source.ts b/src/plugins/data/public/search/search_source/search_source.ts
index 9d2bb889953cf..c70db7bb82ef7 100644
--- a/src/plugins/data/public/search/search_source/search_source.ts
+++ b/src/plugins/data/public/search/search_source/search_source.ts
@@ -70,19 +70,17 @@
*/
import _ from 'lodash';
-import { map } from 'rxjs/operators';
import { SavedObjectReference } from 'kibana/public';
import { normalizeSortRequest } from './normalize_sort_request';
import { filterDocvalueFields } from './filter_docvalue_fields';
import { fieldWildcardFilter } from '../../../../kibana_utils/public';
import { IIndexPattern, SearchRequest } from '../..';
import { SearchSourceOptions, SearchSourceFields } from './types';
-import { FetchOptions, RequestFailure, getSearchParams, handleResponse } from '../fetch';
+import { fetchSoon, FetchOptions, RequestFailure } from '../fetch';
import { getSearchService, getUiSettings, getInjectedMetadata } from '../../services';
import { getEsQueryConfig, buildEsQuery, Filter } from '../../../common';
import { getHighlightRequest } from '../../../common/field_formats';
-import { fetchSoon } from '../legacy';
export type ISearchSource = Pick;
@@ -187,29 +185,18 @@ export class SearchSource {
}
/**
- * Run a search using the search service
- * @return {Observable>}
+ * Fetch this source and reject the returned Promise on error
+ *
+ * @async
*/
- private fetch$(searchRequest: SearchRequest, signal?: AbortSignal) {
- const esShardTimeout = getInjectedMetadata().getInjectedVar('esShardTimeout') as number;
- const searchParams = getSearchParams(getUiSettings(), esShardTimeout);
- const params = {
- index: searchRequest.index.title || searchRequest.index,
- body: searchRequest.body,
- ...searchParams,
- };
- return getSearchService()
- .search({ params, indexType: searchRequest.indexType }, { signal })
- .pipe(map(({ rawResponse }) => handleResponse(searchRequest, rawResponse)));
- }
+ async fetch(options: FetchOptions = {}) {
+ await this.requestIsStarting(options);
+
+ const searchRequest = await this.flatten();
+ this.history = [searchRequest];
- /**
- * Run a search using the search service
- * @return {Promise>}
- */
- private async legacyFetch(searchRequest: SearchRequest, options: FetchOptions) {
const esShardTimeout = getInjectedMetadata().getInjectedVar('esShardTimeout') as number;
- return await fetchSoon(
+ const response = await fetchSoon(
searchRequest,
{
...(this.searchStrategyId && { searchStrategyId: this.searchStrategyId }),
@@ -221,24 +208,6 @@ export class SearchSource {
esShardTimeout,
}
);
- }
- /**
- * Fetch this source and reject the returned Promise on error
- *
- * @async
- */
- async fetch(options: FetchOptions = {}) {
- await this.requestIsStarting(options);
-
- const searchRequest = await this.flatten();
- this.history = [searchRequest];
-
- let response;
- if (getUiSettings().get('courier:batchSearches')) {
- response = await this.legacyFetch(searchRequest, options);
- } else {
- response = this.fetch$(searchRequest, options.abortSignal).toPromise();
- }
if (response.error) {
throw new RequestFailure(null, response);
@@ -277,6 +246,7 @@ export class SearchSource {
/**
* Called by requests of this search source when they are started
+ * @param {Courier.Request} request
* @param options
* @return {Promise}
*/
@@ -460,6 +430,7 @@ export class SearchSource {
* and `kibanaSavedObjectMeta.searchSourceJSON.filter[].meta.index`.
*
* Using `createSearchSource`, the instance can be re-created.
+ * @param searchSource The search source to serialize
* @public */
public serialize() {
const references: SavedObjectReference[] = [];
diff --git a/src/plugins/data/public/search/legacy/default_search_strategy.test.ts b/src/plugins/data/public/search/search_strategy/default_search_strategy.test.ts
similarity index 83%
rename from src/plugins/data/public/search/legacy/default_search_strategy.test.ts
rename to src/plugins/data/public/search/search_strategy/default_search_strategy.test.ts
index 835b02b3cd5c7..210a0e5fd1ac7 100644
--- a/src/plugins/data/public/search/legacy/default_search_strategy.test.ts
+++ b/src/plugins/data/public/search/search_strategy/default_search_strategy.test.ts
@@ -17,10 +17,10 @@
* under the License.
*/
-import { IUiSettingsClient } from 'kibana/public';
+import { IUiSettingsClient } from '../../../../../core/public';
+import { SearchStrategySearchParams } from './types';
import { defaultSearchStrategy } from './default_search_strategy';
import { searchStartMock } from '../mocks';
-import { SearchStrategySearchParams } from './types';
const { search } = defaultSearchStrategy;
@@ -38,6 +38,12 @@ const searchMockResponse: any = Promise.resolve([]);
searchMockResponse.abort = jest.fn();
const searchMock = jest.fn().mockReturnValue(searchMockResponse);
+const newSearchMockResponse: any = Promise.resolve([]);
+newSearchMockResponse.abort = jest.fn();
+const newSearchMock = jest.fn().mockReturnValue({
+ toPromise: () => searchMockResponse,
+});
+
describe('defaultSearchStrategy', function() {
describe('search', function() {
let searchArgs: MockedKeys>;
@@ -52,6 +58,7 @@ describe('defaultSearchStrategy', function() {
const searchService = searchStartMock;
searchService.aggs.calculateAutoTimeExpression = jest.fn().mockReturnValue('1d');
+ searchService.search = newSearchMock;
searchService.__LEGACY.esClient.search = searchMock;
searchService.__LEGACY.esClient.msearch = msearchMock;
@@ -105,5 +112,18 @@ describe('defaultSearchStrategy', function() {
search({ ...searchArgs, config }).abort();
expect(msearchMockResponse.abort).toHaveBeenCalled();
});
+
+ test('should call new search service', () => {
+ const config = getConfigStub();
+ search({ ...searchArgs, config });
+ expect(newSearchMock).toHaveBeenCalledTimes(1);
+ });
+
+ test('should properly abort with new search service', async () => {
+ const abortSpy = jest.spyOn(AbortController.prototype, 'abort');
+ const config = getConfigStub({});
+ search({ ...searchArgs, config }).abort();
+ expect(abortSpy).toHaveBeenCalled();
+ });
});
});
diff --git a/src/plugins/data/public/search/legacy/default_search_strategy.ts b/src/plugins/data/public/search/search_strategy/default_search_strategy.ts
similarity index 64%
rename from src/plugins/data/public/search/legacy/default_search_strategy.ts
rename to src/plugins/data/public/search/search_strategy/default_search_strategy.ts
index 1552410f9090c..2bd88f51587a8 100644
--- a/src/plugins/data/public/search/legacy/default_search_strategy.ts
+++ b/src/plugins/data/public/search/search_strategy/default_search_strategy.ts
@@ -17,19 +17,23 @@
* under the License.
*/
-import { getPreference, getTimeout } from '../fetch';
-import { getMSearchParams } from './get_msearch_params';
import { SearchStrategyProvider, SearchStrategySearchParams } from './types';
+import { isDefault } from '../../index_patterns';
+import { getSearchParams, getMSearchParams, getPreference, getTimeout } from './get_search_params';
-// @deprecated
export const defaultSearchStrategy: SearchStrategyProvider = {
id: 'default',
search: params => {
- return msearch(params);
+ return params.config.get('courier:batchSearches') ? msearch(params) : search(params);
+ },
+
+ isViable: indexPattern => {
+ return indexPattern && isDefault(indexPattern);
},
};
+// @deprecated
function msearch({
searchRequests,
searchService,
@@ -61,3 +65,29 @@ function msearch({
abort: searching.abort,
};
}
+
+function search({
+ searchRequests,
+ searchService,
+ config,
+ esShardTimeout,
+}: SearchStrategySearchParams) {
+ const abortController = new AbortController();
+ const searchParams = getSearchParams(config, esShardTimeout);
+ const promises = searchRequests.map(({ index, indexType, body }) => {
+ const params = {
+ index: index.title || index,
+ body,
+ ...searchParams,
+ };
+ const { signal } = abortController;
+ return searchService
+ .search({ params, indexType }, { signal })
+ .toPromise()
+ .then(({ rawResponse }) => rawResponse);
+ });
+ return {
+ searching: Promise.all(promises),
+ abort: () => abortController.abort(),
+ };
+}
diff --git a/src/plugins/data/public/search/legacy/get_msearch_params.test.ts b/src/plugins/data/public/search/search_strategy/get_search_params.test.ts
similarity index 60%
rename from src/plugins/data/public/search/legacy/get_msearch_params.test.ts
rename to src/plugins/data/public/search/search_strategy/get_search_params.test.ts
index 9f16d5b408178..76f3105d7f942 100644
--- a/src/plugins/data/public/search/legacy/get_msearch_params.test.ts
+++ b/src/plugins/data/public/search/search_strategy/get_search_params.test.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { getMSearchParams } from './get_msearch_params';
+import { getMSearchParams, getSearchParams } from './get_search_params';
import { IUiSettingsClient } from '../../../../../core/public';
function getConfigStub(config: any = {}) {
@@ -64,3 +64,46 @@ describe('getMSearchParams', () => {
expect(msearchParams.hasOwnProperty('timeout')).toBe(false);
});
});
+
+describe('getSearchParams', () => {
+ test('includes rest_total_hits_as_int', () => {
+ const config = getConfigStub();
+ const searchParams = getSearchParams(config);
+ expect(searchParams.rest_total_hits_as_int).toBe(true);
+ });
+
+ test('includes ignore_unavailable', () => {
+ const config = getConfigStub();
+ const searchParams = getSearchParams(config);
+ expect(searchParams.ignore_unavailable).toBe(true);
+ });
+
+ test('includes ignore_throttled according to search:includeFrozen', () => {
+ let config = getConfigStub({ 'search:includeFrozen': true });
+ let searchParams = getSearchParams(config);
+ expect(searchParams.ignore_throttled).toBe(false);
+
+ config = getConfigStub({ 'search:includeFrozen': false });
+ searchParams = getSearchParams(config);
+ expect(searchParams.ignore_throttled).toBe(true);
+ });
+
+ test('includes max_concurrent_shard_requests according to courier:maxConcurrentShardRequests', () => {
+ let config = getConfigStub({ 'courier:maxConcurrentShardRequests': 0 });
+ let searchParams = getSearchParams(config);
+ expect(searchParams.max_concurrent_shard_requests).toBe(undefined);
+
+ config = getConfigStub({ 'courier:maxConcurrentShardRequests': 5 });
+ searchParams = getSearchParams(config);
+ expect(searchParams.max_concurrent_shard_requests).toBe(5);
+ });
+
+ test('includes timeout according to esShardTimeout if greater than 0', () => {
+ const config = getConfigStub();
+ let searchParams = getSearchParams(config, 0);
+ expect(searchParams.timeout).toBe(undefined);
+
+ searchParams = getSearchParams(config, 100);
+ expect(searchParams.timeout).toBe('100ms');
+ });
+});
diff --git a/src/plugins/data/public/search/fetch/get_search_params.ts b/src/plugins/data/public/search/search_strategy/get_search_params.ts
similarity index 81%
rename from src/plugins/data/public/search/fetch/get_search_params.ts
rename to src/plugins/data/public/search/search_strategy/get_search_params.ts
index f0c43bd2e74cd..9fb8f2c728c6f 100644
--- a/src/plugins/data/public/search/fetch/get_search_params.ts
+++ b/src/plugins/data/public/search/search_strategy/get_search_params.ts
@@ -17,10 +17,18 @@
* under the License.
*/
-import { IUiSettingsClient } from 'kibana/public';
+import { IUiSettingsClient } from '../../../../../core/public';
const sessionId = Date.now();
+export function getMSearchParams(config: IUiSettingsClient) {
+ return {
+ rest_total_hits_as_int: true,
+ ignore_throttled: getIgnoreThrottled(config),
+ max_concurrent_shard_requests: getMaxConcurrentShardRequests(config),
+ };
+}
+
export function getSearchParams(config: IUiSettingsClient, esShardTimeout: number = 0) {
return {
rest_total_hits_as_int: true,
@@ -32,11 +40,11 @@ export function getSearchParams(config: IUiSettingsClient, esShardTimeout: numbe
};
}
-export function getIgnoreThrottled(config: IUiSettingsClient) {
+function getIgnoreThrottled(config: IUiSettingsClient) {
return !config.get('search:includeFrozen');
}
-export function getMaxConcurrentShardRequests(config: IUiSettingsClient) {
+function getMaxConcurrentShardRequests(config: IUiSettingsClient) {
const maxConcurrentShardRequests = config.get('courier:maxConcurrentShardRequests');
return maxConcurrentShardRequests > 0 ? maxConcurrentShardRequests : undefined;
}
diff --git a/src/plugins/data/public/search/legacy/index.ts b/src/plugins/data/public/search/search_strategy/index.ts
similarity index 78%
rename from src/plugins/data/public/search/legacy/index.ts
rename to src/plugins/data/public/search/search_strategy/index.ts
index e2ae72824f3f4..e3de2ea46e3ec 100644
--- a/src/plugins/data/public/search/legacy/index.ts
+++ b/src/plugins/data/public/search/search_strategy/index.ts
@@ -17,5 +17,8 @@
* under the License.
*/
-export { fetchSoon } from './fetch_soon';
-export { getEsClient, LegacyApiCaller } from './es_client';
+export { SearchError, getSearchErrorType } from './search_error';
+
+export { SearchStrategyProvider, SearchStrategySearchParams } from './types';
+
+export { defaultSearchStrategy } from './default_search_strategy';
diff --git a/src/plugins/data/public/search/search_strategy/no_op_search_strategy.ts b/src/plugins/data/public/search/search_strategy/no_op_search_strategy.ts
new file mode 100644
index 0000000000000..dc7331e614a0e
--- /dev/null
+++ b/src/plugins/data/public/search/search_strategy/no_op_search_strategy.ts
@@ -0,0 +1,55 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { i18n } from '@kbn/i18n';
+import { SearchError } from './search_error';
+import { SearchStrategyProvider } from './types';
+
+export const noOpSearchStrategy: SearchStrategyProvider = {
+ id: 'noOp',
+
+ search: () => {
+ const searchError = new SearchError({
+ status: '418', // "I'm a teapot" error
+ title: i18n.translate(
+ 'data.search.searchSource.noSearchStrategyRegisteredErrorMessageTitle',
+ {
+ defaultMessage: 'No search strategy registered',
+ }
+ ),
+ message: i18n.translate(
+ 'data.search.searchSource.noSearchStrategyRegisteredErrorMessageDescription',
+ {
+ defaultMessage: `Couldn't find a search strategy for the search request`,
+ }
+ ),
+ type: 'NO_OP_SEARCH_STRATEGY',
+ path: '',
+ });
+
+ return {
+ searching: Promise.reject(searchError),
+ abort: () => {},
+ };
+ },
+
+ isViable: () => {
+ return true;
+ },
+};
diff --git a/src/plugins/data/public/search/fetch/search_error.ts b/src/plugins/data/public/search/search_strategy/search_error.ts
similarity index 100%
rename from src/plugins/data/public/search/fetch/search_error.ts
rename to src/plugins/data/public/search/search_strategy/search_error.ts
diff --git a/src/plugins/data/public/search/legacy/types.ts b/src/plugins/data/public/search/search_strategy/types.ts
similarity index 89%
rename from src/plugins/data/public/search/legacy/types.ts
rename to src/plugins/data/public/search/search_strategy/types.ts
index 3812cec7a2aa2..764370d8ff649 100644
--- a/src/plugins/data/public/search/legacy/types.ts
+++ b/src/plugins/data/public/search/search_strategy/types.ts
@@ -17,20 +17,21 @@
* under the License.
*/
-import { FetchHandlers } from '../fetch';
+import { IndexPattern } from '../..';
+import { FetchHandlers } from '../fetch/types';
import { SearchRequest, SearchResponse } from '..';
-export interface SearchStrategySearchParams extends FetchHandlers {
- searchRequests: SearchRequest[];
-}
-
-// @deprecated
export interface SearchStrategyProvider {
id: string;
search: (params: SearchStrategySearchParams) => SearchStrategyResponse;
+ isViable: (indexPattern: IndexPattern) => boolean;
}
export interface SearchStrategyResponse {
searching: Promise;
abort: () => void;
}
+
+export interface SearchStrategySearchParams extends FetchHandlers {
+ searchRequests: SearchRequest[];
+}
diff --git a/src/plugins/data/public/search/types.ts b/src/plugins/data/public/search/types.ts
index 2122e4e82ec1d..ba6e44f47b75e 100644
--- a/src/plugins/data/public/search/types.ts
+++ b/src/plugins/data/public/search/types.ts
@@ -22,7 +22,7 @@ import { createSearchSource } from './search_source';
import { SearchAggsSetup, SearchAggsStart, SearchAggsStartLegacy } from './aggs';
import { ISearch, ISearchGeneric } from './i_search';
import { TStrategyTypes } from './strategy_types';
-import { LegacyApiCaller } from './legacy/es_client';
+import { LegacyApiCaller } from './es_client';
import { SearchInterceptor } from './search_interceptor';
export interface ISearchContext {
@@ -38,6 +38,15 @@ export interface ISearchStrategy {
search: ISearch;
}
+/**
+ * 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.
+ */
+export type TSearchStrategyProviderEnhanced = (
+ search: ISearchGeneric
+) => Promise>;
+
export type TSearchStrategiesMap = {
[K in TStrategyTypes]?: TSearchStrategyProvider;
};
diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json
index d67a9dbf960ec..7f5bd0eda809b 100644
--- a/x-pack/plugins/translations/translations/ja-JP.json
+++ b/x-pack/plugins/translations/translations/ja-JP.json
@@ -850,6 +850,8 @@
"data.search.searchSource.indexPatternIdDescription": "{kibanaIndexPattern} インデックス内の ID です。",
"data.search.searchSource.indexPatternIdLabel": "インデックスパターン ID",
"data.search.searchSource.indexPatternLabel": "インデックスパターン",
+ "data.search.searchSource.noSearchStrategyRegisteredErrorMessageDescription": "検索リクエストの検索方法が見つかりませんでした",
+ "data.search.searchSource.noSearchStrategyRegisteredErrorMessageTitle": "検索方法が登録されていません",
"data.search.searchSource.queryTimeDescription": "クエリの処理の所要時間です。リクエストの送信やブラウザでのパースの時間は含まれません。",
"data.search.searchSource.queryTimeLabel": "クエリ時間",
"data.search.searchSource.queryTimeValue": "{queryTime}ms",
diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json
index e29bf8b6d9498..6fc2e1f146086 100644
--- a/x-pack/plugins/translations/translations/zh-CN.json
+++ b/x-pack/plugins/translations/translations/zh-CN.json
@@ -851,6 +851,8 @@
"data.search.searchSource.indexPatternIdDescription": "{kibanaIndexPattern} 索引中的 ID。",
"data.search.searchSource.indexPatternIdLabel": "索引模式 ID",
"data.search.searchSource.indexPatternLabel": "索引模式",
+ "data.search.searchSource.noSearchStrategyRegisteredErrorMessageDescription": "无法为该搜索请求找到搜索策略",
+ "data.search.searchSource.noSearchStrategyRegisteredErrorMessageTitle": "未注册任何搜索策略",
"data.search.searchSource.queryTimeDescription": "处理查询所花费的时间。不包括发送请求或在浏览器中解析它的时间。",
"data.search.searchSource.queryTimeLabel": "查询时间",
"data.search.searchSource.queryTimeValue": "{queryTime}ms",