do not use es from setup (#67277)
This commit is contained in:
parent
b10bd03734
commit
85bdd940c8
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
* 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 { once } from 'lodash';
|
||||
import { getDataClient } from '../kibana_server_services';
|
||||
|
||||
const callWithRequest = once(() => getDataClient());
|
||||
|
||||
export const callWithRequestFactory = (request) => {
|
||||
return (...args) => {
|
||||
return (
|
||||
callWithRequest()
|
||||
.asScoped(request)
|
||||
// @ts-ignore
|
||||
.callAsCurrentUser(...args)
|
||||
);
|
||||
};
|
||||
};
|
|
@ -4,13 +4,6 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
let dataClient;
|
||||
|
||||
export const setElasticsearchClientServices = (elasticsearch) => {
|
||||
({ dataClient } = elasticsearch);
|
||||
};
|
||||
export const getDataClient = () => dataClient;
|
||||
|
||||
let internalRepository;
|
||||
export const setInternalRepository = (createInternalRepository) => {
|
||||
internalRepository = createInternalRepository();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
import { initRoutes } from './routes/file_upload';
|
||||
import { setElasticsearchClientServices, setInternalRepository } from './kibana_server_services';
|
||||
import { setInternalRepository } from './kibana_server_services';
|
||||
import { registerFileUploadUsageCollector, fileUploadTelemetryMappingsType } from './telemetry';
|
||||
|
||||
export class FileUploadPlugin {
|
||||
|
@ -15,7 +15,6 @@ export class FileUploadPlugin {
|
|||
|
||||
setup(core, plugins) {
|
||||
core.savedObjects.registerType(fileUploadTelemetryMappingsType);
|
||||
setElasticsearchClientServices(core.elasticsearch);
|
||||
this.router = core.http.createRouter();
|
||||
registerFileUploadUsageCollector(plugins.usageCollection);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { callWithRequestFactory } from '../client/call_with_request_factory';
|
||||
import { importDataProvider } from '../models/import_data';
|
||||
import { updateTelemetry } from '../telemetry/telemetry';
|
||||
import { MAX_BYTES } from '../../common/constants/file_import';
|
||||
|
@ -86,7 +85,7 @@ const finishValidationAndProcessReq = () => {
|
|||
let resp;
|
||||
try {
|
||||
const validIdReqData = idConditionalValidation(body, boolHasId);
|
||||
const callWithRequest = callWithRequestFactory(req);
|
||||
const callWithRequest = con.core.elasticsearch.dataClient.callAsCurrentUser;
|
||||
const { importData: importDataFunc } = importDataProvider(callWithRequest);
|
||||
|
||||
const { index, settings, mappings, ingestPipeline, data } = validIdReqData;
|
||||
|
|
Loading…
Reference in a new issue