Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
02c57f3
Add async search strategy
lukasolson Dec 9, 2019
41b7c6a
Add async search
lukasolson Dec 9, 2019
cf5ceb9
Fix async strategy and add tests
lukasolson Dec 13, 2019
5ad5b36
Merge branch 'master' into asyncSearch
lukasolson Dec 13, 2019
2009343
Move types to separate file
lukasolson Dec 14, 2019
ebebdaf
Revert changes to demo search
lukasolson Dec 14, 2019
65c39b6
Merge branch 'master' into asyncSearch
lukasolson Dec 17, 2019
5dd876f
Update demo search strategy to use async
lukasolson Dec 18, 2019
d487812
Add async es search strategy
lukasolson Dec 18, 2019
7433aa6
Return response as rawResponse
lukasolson Dec 19, 2019
93ea93e
Poll after initial request
lukasolson Dec 19, 2019
8e8eb7b
Merge branch 'master' into asyncSearch
lukasolson Jan 15, 2020
f15c4af
Merge branch 'master' into enhancedEsSearch
lukasolson Jan 15, 2020
50b4b69
Merge branch 'master' into asyncSearch
lukasolson Jan 23, 2020
2bed4a6
Merge branch 'master' into asyncSearch
lukasolson Jan 23, 2020
b6d9c25
Merge branch 'asyncSearch' into enhancedEsSearch
lukasolson Jan 23, 2020
7260761
Add cancellation to search strategies
lukasolson Jan 24, 2020
be300db
Add tests
lukasolson Jan 27, 2020
fa02de6
Merge branch 'master' into asyncSearch
lukasolson Jan 27, 2020
4e524d1
Merge branch 'asyncSearch' into enhancedEsSearch
lukasolson Jan 27, 2020
7ad5755
Merge branch 'master' into asyncSearch
lukasolson Jan 28, 2020
e4eb651
Simplify async search strategy
lukasolson Jan 28, 2020
b6a7f5e
Merge branch 'asyncSearch' into enhancedEsSearch
lukasolson Jan 28, 2020
6188c74
Move loadingCount to search strategy
lukasolson Jan 29, 2020
765ec61
Merge branch 'loadingCount' into asyncSearch
lukasolson Jan 30, 2020
b35ca0f
Merge branch 'asyncSearch' into enhancedEsSearch
lukasolson Jan 30, 2020
f15f138
Update abort controller library
lukasolson Feb 3, 2020
4d36124
Bootstrap
lukasolson Feb 3, 2020
1943855
Merge branch 'master' into abortController
elasticmachine Feb 3, 2020
c7e328c
Merge branch 'master' into asyncSearch
elasticmachine Feb 4, 2020
491e8bb
Abort when the request is aborted
lukasolson Feb 4, 2020
d5d995c
Merge branch 'master' into abortController
lukasolson Feb 4, 2020
8afc936
Merge branch 'abortController' of github.com:lukasolson/kibana into a…
lukasolson Feb 4, 2020
48238d8
Merge branch 'abortController' into abortSearch
lukasolson Feb 4, 2020
0db7257
Add utility and update value suggestions route
lukasolson Feb 4, 2020
2f00b41
Merge branch 'master' into asyncSearch
lukasolson Feb 4, 2020
b8711ca
Merge branch 'abortController' into asyncSearch
lukasolson Feb 4, 2020
f02792f
Fix bad merge conflict
lukasolson Feb 4, 2020
30886d1
Merge branch 'abortController' into asyncSearch
lukasolson Feb 4, 2020
2cb8dd4
Update tests
lukasolson Feb 4, 2020
229af5a
Merge remote-tracking branch 'origin/asyncSearch' into asyncSearch
lukasolson Feb 4, 2020
2a53834
Move to data_enhanced plugin
lukasolson Feb 5, 2020
3a6dd41
Merge branch 'asyncSearch' into enhancedEsSearch
lukasolson Feb 5, 2020
f376da7
Merge branch 'master' into abortSearch
lukasolson Feb 5, 2020
ad5f188
Remove bad merge
lukasolson Feb 6, 2020
48b88c0
Revert switching abort controller libraries
lukasolson Feb 10, 2020
21dd1c8
Revert package.json in lib
lukasolson Feb 10, 2020
16064ff
Merge branch 'revertAbortController' into abortSearch
lukasolson Feb 10, 2020
a079c15
Merge branch 'master' into revertAbortController
elasticmachine Feb 10, 2020
0b87a0b
Move to previous abort controller
lukasolson Feb 10, 2020
55d76f3
Merge branch 'master' into abortSearch
lukasolson Feb 10, 2020
1aa401d
Merge branch 'master' into asyncSearch
lukasolson Feb 10, 2020
7cd1092
Merge branch 'asyncSearch' into enhancedEsSearch
lukasolson Feb 10, 2020
8292c1e
Merge branch 'master' into revertAbortController
lukasolson Feb 10, 2020
e45bdd6
Merge remote-tracking branch 'origin/revertAbortController' into reve…
lukasolson Feb 10, 2020
d3291a8
Merge branch 'master' into revertAbortController
elasticmachine Feb 12, 2020
599c564
Merge branch 'master' into enhancedEsSearch
elasticmachine Feb 12, 2020
c25d3a9
Merge branch 'master' into asyncSearch
elasticmachine Feb 12, 2020
f996a65
Merge branch 'master' into abortSearch
lukasolson Feb 12, 2020
91655f2
Merge branch 'abortSearch' into asyncSearch
lukasolson Feb 12, 2020
8447981
Merge branch 'asyncSearch' of github.com:lukasolson/kibana into async…
lukasolson Feb 12, 2020
4badc14
Merge branch 'master' into revertAbortController
lukasolson Feb 12, 2020
6df7a41
Merge branch 'asyncSearch' into enhancedEsSearch
lukasolson Feb 12, 2020
7dc053e
Merge branch 'enhancedEsSearch' of github.com:lukasolson/kibana into …
lukasolson Feb 12, 2020
e959aad
Add support for frozen indices
lukasolson Feb 14, 2020
c9352e3
Merge branch 'master' into revertAbortController
lukasolson Feb 14, 2020
100a728
Merge branch 'revertAbortController' into abortSearch
lukasolson Feb 14, 2020
35b1abb
Fix test to use fake timers to run debounced handlers
lukasolson Feb 14, 2020
84bda2e
Merge branch 'abortSearch' into asyncSearch
lukasolson Feb 14, 2020
8822ec8
Merge branch 'asyncSearch' into enhancedEsSearch
lukasolson Feb 14, 2020
0db590e
Merge branch 'master' into abortSearch
lukasolson Feb 18, 2020
b2ebe1e
Merge branch 'master' into asyncSearch
lukasolson Feb 18, 2020
5ec9c30
Merge branch 'master' into enhancedEsSearch
lukasolson Feb 18, 2020
6cff829
Merge branch 'master' into abortSearch
lukasolson Feb 18, 2020
831cb9f
Merge branch 'master' into asyncSearch
lukasolson Feb 18, 2020
d71d900
Revert changes to example plugin
lukasolson Feb 18, 2020
914d330
Fix loading bar not going away when cancelling
lukasolson Feb 18, 2020
fb5ef63
Merge branch 'master' into abortSearch
lukasolson Feb 18, 2020
df1fa5e
Merge branch 'abortSearch' into asyncSearch
lukasolson Feb 18, 2020
07b6903
Merge branch 'asyncSearch' into enhancedEsSearch
lukasolson Feb 18, 2020
c8c1a95
Merge branch 'master' into abortSearch
lukasolson Feb 19, 2020
6a6df45
Merge branch 'master' into asyncSearch
lukasolson Feb 19, 2020
d8fd759
Call getSearchStrategy instead of passing directly
lukasolson Feb 19, 2020
b7407ea
Merge branch 'master' into asyncSearch
lukasolson Feb 20, 2020
e6f11db
Add async demo search strategy
lukasolson Feb 20, 2020
9337dea
Fix error with setting state
lukasolson Feb 20, 2020
365ace1
Merge branch 'master' into abortSearch
elasticmachine Feb 20, 2020
f0c2c9c
Merge branch 'master' into abortSearch
elasticmachine Feb 24, 2020
a6921d7
Merge branch 'master' into asyncSearch
lukasolson Feb 24, 2020
4267bf2
Update how aborting works
lukasolson Feb 24, 2020
418e4a1
Fix type checks
lukasolson Feb 24, 2020
159f5f0
Add test for loading count
lukasolson Feb 24, 2020
5bbae56
Merge remote-tracking branch 'origin/abortSearch' into abortSearch
lukasolson Feb 24, 2020
71ca887
Merge branch 'master' into asyncSearch
lukasolson Feb 24, 2020
dae93b1
Attempt to fix broken example test
lukasolson Feb 25, 2020
7f55c43
Merge branch 'master' into abortSearch
lukasolson Feb 25, 2020
248e094
Merge branch 'master' into asyncSearch
lukasolson Feb 25, 2020
1da1ce0
Revert changes to test
lukasolson Feb 25, 2020
ae16a51
Merge branch 'master' into asyncSearch
elasticmachine Feb 25, 2020
efa6cf6
Fix test
lukasolson Feb 25, 2020
cdb5417
Update name to camelCase
lukasolson Feb 25, 2020
b38d45d
Merge branch 'asyncSearch' of github.com:lukasolson/kibana into async…
lukasolson Feb 25, 2020
2ec0d0b
Fix failing test
lukasolson Feb 25, 2020
168ccc7
Merge branch 'abortSearch' into asyncSearch
lukasolson Feb 25, 2020
4325fec
Don't require data_enhanced in example plugin
lukasolson Feb 25, 2020
df2c99d
Merge branch 'asyncSearch' into enhancedEsSearch
lukasolson Feb 25, 2020
1f99f21
Actually send DELETE request
lukasolson Feb 26, 2020
74b3718
Use waitForCompletion parameter
lukasolson Feb 27, 2020
e30e047
Use default search params
lukasolson Feb 29, 2020
e45021c
Add support for rollups
lukasolson Mar 2, 2020
b71c661
Merge branch 'master' into enhancedEsSearch
lukasolson Mar 3, 2020
20ce66a
Only make changes needed for frozen indices/rollups
lukasolson Mar 3, 2020
eaffdb5
Merge branch 'master' into enhancedEs
lukasolson Mar 3, 2020
e0ce774
Fix tests/types
lukasolson Mar 5, 2020
7f6ed11
Merge branch 'master' into enhancedEs
lukasolson Mar 5, 2020
9842cff
Don't include skipped in loaded/total
lukasolson Mar 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/plugins/data/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ export * from './index_patterns';
export * from './es_query';
export * from './utils';
export * from './types';
export * from './search';
export * from './constants';
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ export const esSearchStrategyProvider: TSearchStrategyProvider<typeof ES_SEARCH_
const { search } = syncStrategyProvider(context);
return {
search: (request, options) => {
if (typeof request.params.preference === 'undefined') {
const setPreference = context.core.uiSettings.get('courier:setRequestPreference');
const customPreference = context.core.uiSettings.get('courier:customRequestPreference');
request.params.preference = getEsPreference(setPreference, customPreference);
}
request.params = {
preference: getEsPreference(context.core.uiSettings),
...request.params,
};
return search({ ...request, serverStrategy: ES_SEARCH_STRATEGY }, options) as Observable<
IEsSearchResponse
>;
Expand Down
39 changes: 25 additions & 14 deletions src/plugins/data/public/search/es_search/get_es_preference.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,40 @@
*/

import { getEsPreference } from './get_es_preference';

jest.useFakeTimers();
import { CoreStart } from '../../../../../core/public';
import { coreMock } from '../../../../../core/public/mocks';

describe('Get ES preference', () => {
let mockCoreStart: MockedKeys<CoreStart>;

beforeEach(() => {
mockCoreStart = coreMock.createStart();
});

test('returns the session ID if set to sessionId', () => {
const setPreference = 'sessionId';
const customPreference = 'foobar';
const sessionId = 'my_session_id';
const preference = getEsPreference(setPreference, customPreference, sessionId);
expect(preference).toBe(sessionId);
mockCoreStart.uiSettings.get.mockImplementation((key: string) => {
if (key === 'courier:setRequestPreference') return 'sessionId';
if (key === 'courier:customRequestPreference') return 'foobar';
});
const preference = getEsPreference(mockCoreStart.uiSettings, 'my_session_id');
expect(preference).toBe('my_session_id');
});

test('returns the custom preference if set to custom', () => {
const setPreference = 'custom';
const customPreference = 'foobar';
const preference = getEsPreference(setPreference, customPreference);
expect(preference).toBe(customPreference);
mockCoreStart.uiSettings.get.mockImplementation((key: string) => {
if (key === 'courier:setRequestPreference') return 'custom';
if (key === 'courier:customRequestPreference') return 'foobar';
});
const preference = getEsPreference(mockCoreStart.uiSettings);
expect(preference).toBe('foobar');
});

test('returns undefined if set to none', () => {
const setPreference = 'none';
const customPreference = 'foobar';
const preference = getEsPreference(setPreference, customPreference);
mockCoreStart.uiSettings.get.mockImplementation((key: string) => {
if (key === 'courier:setRequestPreference') return 'none';
if (key === 'courier:customRequestPreference') return 'foobar';
});
const preference = getEsPreference(mockCoreStart.uiSettings);
expect(preference).toBe(undefined);
});
});
14 changes: 7 additions & 7 deletions src/plugins/data/public/search/es_search/get_es_preference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
* under the License.
*/

import { IUiSettingsClient } from '../../../../../core/public';

const defaultSessionId = `${Date.now()}`;

export function getEsPreference(
setRequestPreference: string,
customRequestPreference?: string,
sessionId: string = defaultSessionId
) {
if (setRequestPreference === 'sessionId') return `${sessionId}`;
return setRequestPreference === 'custom' ? customRequestPreference : undefined;
export function getEsPreference(uiSettings: IUiSettingsClient, sessionId = defaultSessionId) {
const setPreference = uiSettings.get('courier:setRequestPreference');
if (setPreference === 'sessionId') return `${sessionId}`;
const customPreference = uiSettings.get('courier:customRequestPreference');
return setPreference === 'custom' ? customPreference : undefined;
}
21 changes: 21 additions & 0 deletions src/plugins/data/public/search/es_search/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* 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.
*/

export { esSearchStrategyProvider } from './es_search_strategy';
export { getEsPreference } from './get_es_preference';
1 change: 1 addition & 0 deletions src/plugins/data/public/search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export {
export { IEsSearchResponse, IEsSearchRequest, ES_SEARCH_STRATEGY } from '../../common/search';

export { ISyncSearchRequest, SYNC_SEARCH_STRATEGY } from './sync_search_strategy';
export { esSearchStrategyProvider, getEsPreference } from './es_search';

export { IKibanaSearchResponse, IKibanaSearchRequest } from '../../common/search';

Expand Down
12 changes: 10 additions & 2 deletions src/plugins/data/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,16 @@ export {
* Search
*/

export { IRequestTypesMap, IResponseTypesMap } from './search';
export * from './search';
export {
ISearch,
ICancel,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ICancel sounds a bit too generic in the context of the data plugin.
I thing all of these types should have the ISearch prefix

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

++ We can address this in a follow-up PR

ISearchOptions,
IRequestTypesMap,
IResponseTypesMap,
ISearchContext,
TSearchStrategyProvider,
getDefaultSearchParams,
} from './search';

/**
* Types to be shared externally
Expand Down
13 changes: 11 additions & 2 deletions src/plugins/data/server/search/create_api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import { TSearchStrategiesMap } from './i_search_strategy';
import { IRouteHandlerSearchContext } from './i_route_handler_search_context';
import { DEFAULT_SEARCH_STRATEGY } from '../../common/search';

// let mockCoreSetup: MockedKeys<CoreSetup>;

const mockDefaultSearch = jest.fn(() => Promise.resolve({ total: 100, loaded: 0 }));
const mockDefaultSearchStrategyProvider = jest.fn(() =>
Promise.resolve({
Expand Down Expand Up @@ -59,4 +57,15 @@ describe('createApi', () => {
`"No strategy found for noneByThisName"`
);
});

it('logs the response if `debug` is set to `true`', async () => {
const spy = jest.spyOn(console, 'log');
await api.search({ params: {} });

expect(spy).not.toBeCalled();

await api.search({ debug: true, params: {} });

expect(spy).toBeCalled();
});
});
4 changes: 4 additions & 0 deletions src/plugins/data/server/search/create_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export function createApi({
}) {
const api: IRouteHandlerSearchContext = {
search: async (request, options, strategyName) => {
if (request.debug) {
// eslint-disable-next-line
console.log(JSON.stringify(request, null, 2));
}
const name = strategyName ?? DEFAULT_SEARCH_STRATEGY;
const strategyProvider = searchStrategies[name];
if (!strategyProvider) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,6 @@ describe('ES search strategy', () => {
expect(typeof esSearch.search).toBe('function');
});

it('logs the response if `debug` is set to `true`', async () => {
const spy = jest.spyOn(console, 'log');
const esSearch = esSearchStrategyProvider(
{
core: mockCoreSetup,
config$: mockConfig$,
},
mockApiCaller,
mockSearch
);

expect(spy).not.toBeCalled();

await esSearch.search({ params: {}, debug: true });

expect(spy).toBeCalled();
});

it('calls the API caller with the params with defaults', async () => {
const params = { index: 'logstash-*' };
const esSearch = esSearchStrategyProvider(
Expand Down
24 changes: 7 additions & 17 deletions src/plugins/data/server/search/es_search/es_search_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { APICaller } from 'kibana/server';
import { SearchResponse } from 'elasticsearch';
import { ES_SEARCH_STRATEGY } from '../../../common/search';
import { ISearchStrategy, TSearchStrategyProvider } from '../i_search_strategy';
import { ISearchContext } from '..';
import { getDefaultSearchParams, ISearchContext } from '..';

export const esSearchStrategyProvider: TSearchStrategyProvider<typeof ES_SEARCH_STRATEGY> = (
context: ISearchContext,
Expand All @@ -30,28 +30,18 @@ export const esSearchStrategyProvider: TSearchStrategyProvider<typeof ES_SEARCH_
return {
search: async (request, options) => {
const config = await context.config$.pipe(first()).toPromise();
const defaultParams = getDefaultSearchParams(config);
const params = {
timeout: `${config.elasticsearch.shardTimeout.asMilliseconds()}ms`,
ignoreUnavailable: true, // Don't fail if the index/indices don't exist
restTotalHitsAsInt: true, // Get the number of hits as an int rather than a range
...defaultParams,
...request.params,
};
if (request.debug) {
// eslint-disable-next-line
console.log(JSON.stringify(params, null, 2));
}
const esSearchResponse = (await caller('search', params, options)) as SearchResponse<any>;
const rawResponse = (await caller('search', params, options)) as SearchResponse<any>;

// The above query will either complete or timeout and throw an error.
// There is no progress indication on this api.
return {
total: esSearchResponse._shards.total,
loaded:
esSearchResponse._shards.failed +
esSearchResponse._shards.skipped +
esSearchResponse._shards.successful,
rawResponse: esSearchResponse,
};
const { total, failed, successful } = rawResponse._shards;
const loaded = failed + successful;
return { total, loaded, rawResponse };
},
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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 { SharedGlobalConfig } from '../../../../../core/server';

export function getDefaultSearchParams(config: SharedGlobalConfig) {
return {
timeout: `${config.elasticsearch.shardTimeout.asMilliseconds()}ms`,
ignoreUnavailable: true, // Don't fail if the index/indices don't exist
restTotalHitsAsInt: true, // Get the number of hits as an int rather than a range
};
}
4 changes: 2 additions & 2 deletions src/plugins/data/server/search/es_search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
* under the License.
*/

export { esSearchStrategyProvider } from './es_search_strategy';

export { ES_SEARCH_STRATEGY, IEsSearchRequest, IEsSearchResponse } from '../../../common/search';
export { esSearchStrategyProvider } from './es_search_strategy';
export { getDefaultSearchParams } from './get_default_search_params';
4 changes: 3 additions & 1 deletion src/plugins/data/server/search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ export { ISearchSetup } from './i_search_setup';

export { ISearchContext } from './i_search_context';

export { IRequestTypesMap, IResponseTypesMap } from './i_search';
export { ISearch, ICancel, ISearchOptions, IRequestTypesMap, IResponseTypesMap } from './i_search';

export { TStrategyTypes } from './strategy_types';

export { TSearchStrategyProvider } from './i_search_strategy';

export { getDefaultSearchParams } from './es_search';
7 changes: 7 additions & 0 deletions x-pack/plugins/data_enhanced/common/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export { EnhancedSearchParams, IEnhancedEsSearchRequest } from './search';
7 changes: 7 additions & 0 deletions x-pack/plugins/data_enhanced/common/search/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export { EnhancedSearchParams, IEnhancedEsSearchRequest } from './types';
19 changes: 19 additions & 0 deletions x-pack/plugins/data_enhanced/common/search/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { SearchParams } from 'elasticsearch';
import { IEsSearchRequest } from '../../../../../src/plugins/data/common';

export interface EnhancedSearchParams extends SearchParams {
ignoreThrottled: boolean;
}

export interface IEnhancedEsSearchRequest extends IEsSearchRequest {
/**
* Used to determine whether to use the _rollups_search or a regular search endpoint.
*/
isRollup?: boolean;
}
2 changes: 1 addition & 1 deletion x-pack/plugins/data_enhanced/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"requiredPlugins": [
"data"
],
"server": false,
"server": true,
"ui": true
}
16 changes: 14 additions & 2 deletions x-pack/plugins/data_enhanced/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@
*/

import { CoreSetup, CoreStart, Plugin } from 'src/core/public';
import { DataPublicPluginSetup, DataPublicPluginStart } from '../../../../src/plugins/data/public';
import {
DataPublicPluginSetup,
DataPublicPluginStart,
ES_SEARCH_STRATEGY,
} from '../../../../src/plugins/data/public';
import { setAutocompleteService } from './services';
import { setupKqlQuerySuggestionProvider, KUERY_LANGUAGE_NAME } from './autocomplete';
import { ASYNC_SEARCH_STRATEGY, asyncSearchStrategyProvider } from './search';
import {
ASYNC_SEARCH_STRATEGY,
asyncSearchStrategyProvider,
enhancedEsSearchStrategyProvider,
} from './search';

export interface DataEnhancedSetupDependencies {
data: DataPublicPluginSetup;
Expand All @@ -29,6 +37,10 @@ export class DataEnhancedPlugin implements Plugin {
setupKqlQuerySuggestionProvider(core)
);
data.search.registerSearchStrategyProvider(ASYNC_SEARCH_STRATEGY, asyncSearchStrategyProvider);
data.search.registerSearchStrategyProvider(
ES_SEARCH_STRATEGY,
enhancedEsSearchStrategyProvider
);
}

public start(core: CoreStart, plugins: DataEnhancedStartDependencies) {
Expand Down
Loading