mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Fix TSVB rollup integration (#56525)
This commit is contained in:
parent
1e325e4fe3
commit
b566ba3a98
4 changed files with 15 additions and 8 deletions
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { RequestHandlerContext } from 'src/core/server';
|
||||
import { KibanaRequest, RequestHandlerContext } from 'src/core/server';
|
||||
import _ from 'lodash';
|
||||
import { first, map } from 'rxjs/operators';
|
||||
import { getPanelData } from './vis_data/get_panel_data';
|
||||
|
@ -57,13 +57,15 @@ export type GetVisData = (
|
|||
export function getVisData(
|
||||
requestContext: RequestHandlerContext,
|
||||
options: GetVisDataOptions,
|
||||
framework: Framework
|
||||
framework: Framework,
|
||||
request?: PublicMethodsOf<KibanaRequest>
|
||||
): Promise<GetVisDataResponse> {
|
||||
// NOTE / TODO: This facade has been put in place to make migrating to the New Platform easier. It
|
||||
// removes the need to refactor many layers of dependencies on "req", and instead just augments the top
|
||||
// level object passed from here. The layers should be refactored fully at some point, but for now
|
||||
// this works and we are still using the New Platform services for these vis data portions.
|
||||
const reqFacade: any = {
|
||||
...(request || {}),
|
||||
payload: options,
|
||||
getUiSettingsService: () => requestContext.core.uiSettings.client,
|
||||
getSavedObjectsClient: () => requestContext.core.savedObjects.client,
|
||||
|
|
|
@ -52,7 +52,7 @@ export const visDataRoutes = (
|
|||
);
|
||||
}
|
||||
try {
|
||||
const results = await getVisData(requestContext, request.body, framework);
|
||||
const results = await getVisData(requestContext, request.body, framework, request);
|
||||
return response.ok({ body: results });
|
||||
} catch (error) {
|
||||
return response.internalError({
|
||||
|
|
|
@ -8,10 +8,10 @@ import { once } from 'lodash';
|
|||
import { elasticsearchJsPlugin } from '../../client/elasticsearch_rollup';
|
||||
|
||||
const callWithRequest = once(server => {
|
||||
const config = { plugins: [elasticsearchJsPlugin] };
|
||||
const cluster = server.plugins.elasticsearch.createCluster('rollup', config);
|
||||
|
||||
return cluster.callWithRequest;
|
||||
const client = server.newPlatform.setup.core.elasticsearch.createClient('rollup', {
|
||||
plugins: [elasticsearchJsPlugin],
|
||||
});
|
||||
return (request, ...args) => client.asScoped(request).callAsCurrentUser(...args);
|
||||
});
|
||||
|
||||
export const callWithRequestFactory = (server, request) => {
|
||||
|
|
|
@ -28,5 +28,10 @@ export const registerRollupSearchStrategy = (kbnServer, server) =>
|
|||
RollupSearchCapabilities
|
||||
);
|
||||
|
||||
addSearchStrategy(new RollupSearchStrategy(server));
|
||||
addSearchStrategy(
|
||||
new RollupSearchStrategy({
|
||||
...server,
|
||||
newPlatform: kbnServer.newPlatform,
|
||||
})
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue