Skip to content

Commit

Permalink
[data.search] Remove deprecated courier:batchSearches advanced setting (
Browse files Browse the repository at this point in the history
#109350)

* [data.search] Handle warnings inside of headers

* Update docs

* Add tests

* Remove isWarningResponse

* Remove deprecated courier:batchSearches advanced setting

* Update docs

* Remove legacy tests

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
lukasolson and kibanamachine authored Aug 23, 2021
1 parent de846fb commit 0a8d42c
Show file tree
Hide file tree
Showing 25 changed files with 7 additions and 640 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ UI_SETTINGS: {
readonly COURIER_SET_REQUEST_PREFERENCE: "courier:setRequestPreference";
readonly COURIER_CUSTOM_REQUEST_PREFERENCE: "courier:customRequestPreference";
readonly COURIER_MAX_CONCURRENT_SHARD_REQUESTS: "courier:maxConcurrentShardRequests";
readonly COURIER_BATCH_SEARCHES: "courier:batchSearches";
readonly SEARCH_INCLUDE_FROZEN: "search:includeFrozen";
readonly SEARCH_TIMEOUT: "search:timeout";
readonly HISTOGRAM_BAR_TARGET: "histogram:barTarget";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ UI_SETTINGS: {
readonly COURIER_SET_REQUEST_PREFERENCE: "courier:setRequestPreference";
readonly COURIER_CUSTOM_REQUEST_PREFERENCE: "courier:customRequestPreference";
readonly COURIER_MAX_CONCURRENT_SHARD_REQUESTS: "courier:maxConcurrentShardRequests";
readonly COURIER_BATCH_SEARCHES: "courier:batchSearches";
readonly SEARCH_INCLUDE_FROZEN: "search:includeFrozen";
readonly SEARCH_TIMEOUT: "search:timeout";
readonly HISTOGRAM_BAR_TARGET: "histogram:barTarget";
Expand Down
8 changes: 0 additions & 8 deletions docs/management/advanced-options.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -398,14 +398,6 @@ changes.
[[kibana-search-settings]]
==== Search

[horizontal]
[[courier-batchsearches]]`courier:batchSearches`::
**Deprecated in 7.6. Starting in 8.0, this setting will be optimized internally.**
When disabled, dashboard panels will load individually, and search requests will
terminate when users navigate away or update the query. When enabled, dashboard
panels will load together when all of the data is loaded, and searches will not
terminate.

[[courier-customrequestpreference]]`courier:customRequestPreference`::
{ref}/search-request-body.html#request-body-search-preference[Request preference]
to use when `courier:setRequestPreference` is set to "custom".
Expand Down
1 change: 0 additions & 1 deletion src/plugins/data/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export const UI_SETTINGS = {
COURIER_SET_REQUEST_PREFERENCE: 'courier:setRequestPreference',
COURIER_CUSTOM_REQUEST_PREFERENCE: 'courier:customRequestPreference',
COURIER_MAX_CONCURRENT_SHARD_REQUESTS: 'courier:maxConcurrentShardRequests',
COURIER_BATCH_SEARCHES: 'courier:batchSearches',
SEARCH_INCLUDE_FROZEN: 'search:includeFrozen',
SEARCH_TIMEOUT: 'search:timeout',
HISTOGRAM_BAR_TARGET: 'histogram:barTarget',
Expand Down
1 change: 0 additions & 1 deletion src/plugins/data/common/search/search_source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export { extractReferences } from './extract_references';
export { parseSearchSourceJSON } from './parse_json';
export { getResponseInspectorStats } from './inspect';
export * from './fetch';
export * from './legacy';
export * from './search_source';
export * from './search_source_service';
export * from './types';
9 changes: 0 additions & 9 deletions src/plugins/data/common/search/search_source/legacy/index.ts

This file was deleted.

29 changes: 0 additions & 29 deletions src/plugins/data/common/search/search_source/legacy/types.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@

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 } from '../../';
import { mockAggTypesRegistry } from '../aggs/test_helpers';
import { RequestResponder } from 'src/plugins/inspector/common';
import { switchMap } from 'rxjs/operators';
Expand Down Expand Up @@ -953,45 +952,6 @@ describe('SearchSource', () => {
});

describe('fetch$', () => {
describe('#legacy COURIER_BATCH_SEARCHES', () => {
beforeEach(() => {
searchSourceDependencies = {
...searchSourceDependencies,
getConfig: jest.fn(() => {
return true; // batchSearches = true
}) as GetConfigFn,
};
});

test('should override to use sync search if not set', async () => {
searchSource = new SearchSource({ index: indexPattern }, searchSourceDependencies);
const options = {};
await searchSource.fetch$(options).toPromise();

const [, callOptions] = mockSearchMethod.mock.calls[0];
expect(callOptions.strategy).toBe(ES_SEARCH_STRATEGY);
});

test('should remove searchSessionId when forcing ES_SEARCH_STRATEGY', async () => {
searchSource = new SearchSource({ index: indexPattern }, searchSourceDependencies);
const options = { sessionId: 'test' };
await searchSource.fetch$(options).toPromise();

const [, callOptions] = mockSearchMethod.mock.calls[0];
expect(callOptions.strategy).toBe(ES_SEARCH_STRATEGY);
expect(callOptions.sessionId).toBeUndefined();
});

test('should not override strategy if set ', async () => {
searchSource = new SearchSource({ index: indexPattern }, searchSourceDependencies);
const options = { strategy: 'banana' };
await searchSource.fetch$(options).toPromise();

const [, callOptions] = mockSearchMethod.mock.calls[0];
expect(callOptions.strategy).toBe('banana');
});
});

describe('responses', () => {
test('should return partial results', async () => {
searchSource = new SearchSource({ index: indexPattern }, searchSourceDependencies);
Expand Down
23 changes: 5 additions & 18 deletions src/plugins/data/common/search/search_source/search_source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
*/

import { setWith } from '@elastic/safer-lodash-set';
import { uniqueId, keyBy, pick, difference, isFunction, isEqual, uniqWith, isObject } from 'lodash';
import { difference, isEqual, isFunction, isObject, keyBy, pick, uniqueId, uniqWith } from 'lodash';
import {
catchError,
finalize,
Expand All @@ -78,7 +78,6 @@ import { fieldWildcardFilter } from '../../../../kibana_utils/common';
import { IIndexPattern, IndexPattern, IndexPatternField } from '../../index_patterns';
import {
AggConfigs,
ES_SEARCH_STRATEGY,
EsQuerySortValue,
IEsSearchResponse,
ISearchGeneric,
Expand All @@ -87,26 +86,25 @@ import {
import type {
ISearchSource,
SearchFieldValue,
SearchSourceOptions,
SearchSourceFields,
SearchSourceOptions,
} from './types';
import { FetchHandlers, RequestFailure, getSearchParamsFromRequest, SearchRequest } from './fetch';
import { FetchHandlers, getSearchParamsFromRequest, RequestFailure, SearchRequest } from './fetch';
import { getRequestInspectorStats, getResponseInspectorStats } from './inspect';

import {
getEsQueryConfig,
UI_SETTINGS,
IKibanaSearchResponse,
isErrorResponse,
isPartialResponse,
IKibanaSearchResponse,
UI_SETTINGS,
} from '../../../common';
import { getHighlightRequest } from '../../../../field_formats/common';
import { extractReferences } from './extract_references';

/** @internal */
export const searchSourceRequiredUiSettings = [
'dateFormat:tz',
UI_SETTINGS.COURIER_BATCH_SEARCHES,
UI_SETTINGS.COURIER_CUSTOM_REQUEST_PREFERENCE,
UI_SETTINGS.COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX,
UI_SETTINGS.COURIER_MAX_CONCURRENT_SHARD_REQUESTS,
Expand Down Expand Up @@ -280,17 +278,6 @@ export class SearchSource {
fetch$(
options: ISearchOptions = {}
): Observable<IKibanaSearchResponse<estypes.SearchResponse<any>>> {
const { getConfig } = this.dependencies;
const syncSearchByDefault = getConfig(UI_SETTINGS.COURIER_BATCH_SEARCHES);

// Use the sync search strategy if legacy search is enabled.
// This still uses bfetch for batching.
if (!options?.strategy && syncSearchByDefault) {
options.strategy = ES_SEARCH_STRATEGY;
// `ES_SEARCH_STRATEGY` doesn't support search sessions, hence remove sessionId
options.sessionId = undefined;
}

const s$ = defer(() => this.requestIsStarting(options)).pipe(
switchMap(() => {
const searchRequest = this.flatten();
Expand Down
1 change: 0 additions & 1 deletion src/plugins/data/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2310,7 +2310,6 @@ export const UI_SETTINGS: {
readonly COURIER_SET_REQUEST_PREFERENCE: "courier:setRequestPreference";
readonly COURIER_CUSTOM_REQUEST_PREFERENCE: "courier:customRequestPreference";
readonly COURIER_MAX_CONCURRENT_SHARD_REQUESTS: "courier:maxConcurrentShardRequests";
readonly COURIER_BATCH_SEARCHES: "courier:batchSearches";
readonly SEARCH_INCLUDE_FROZEN: "search:includeFrozen";
readonly SEARCH_TIMEOUT: "search:timeout";
readonly HISTOGRAM_BAR_TARGET: "histogram:barTarget";
Expand Down
90 changes: 0 additions & 90 deletions src/plugins/data/server/search/routes/call_msearch.test.ts

This file was deleted.

Loading

0 comments on commit 0a8d42c

Please sign in to comment.