Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Switching to new es client #74965

Merged
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
365e4d1
[ML] Switching to new es client
jgowdyelastic Aug 13, 2020
5105961
further conversions
jgowdyelastic Aug 14, 2020
71cdcfa
fixing tests
jgowdyelastic Aug 14, 2020
1c65f4b
updating responses
jgowdyelastic Aug 18, 2020
5a392f6
Merge branch 'master' into switching-to-new-js-client
elasticmachine Aug 18, 2020
e6ac0de
Merge branch 'master' into switching-to-new-js-client
elasticmachine Aug 19, 2020
3672b41
test commit
jgowdyelastic Aug 19, 2020
b110a16
refactoring shared services to removed context parameter
jgowdyelastic Aug 20, 2020
ef3da38
removing last scoped clients
jgowdyelastic Aug 20, 2020
fc7d6bb
removing ml js client
jgowdyelastic Aug 20, 2020
eb67ccb
Merge branch 'master' into switching-to-new-js-client
jgowdyelastic Aug 20, 2020
5a94725
udating file data viz errors
jgowdyelastic Aug 21, 2020
d88ffa9
fixing jest tests
jgowdyelastic Aug 21, 2020
79cfe81
fixing types after merge with master
jgowdyelastic Aug 21, 2020
d8016b8
Merge branch 'master' into switching-to-new-js-client
elasticmachine Aug 24, 2020
b874a77
error response changes
jgowdyelastic Aug 24, 2020
30072fa
adding default sizes to some requests
jgowdyelastic Aug 25, 2020
5d1cae0
adding custom error types for license checks
jgowdyelastic Aug 25, 2020
da6de63
tidying up shared function checks
jgowdyelastic Aug 25, 2020
999b885
removing test data
jgowdyelastic Aug 25, 2020
e29a937
removing need for DummyKibanaRequest
jgowdyelastic Aug 25, 2020
ef3c336
updating comment
jgowdyelastic Aug 25, 2020
cef5b26
Merge branch 'master' into switching-to-new-js-client
elasticmachine Aug 26, 2020
8126c1c
fixing functional api tests
jgowdyelastic Aug 26, 2020
463c53f
removing comments
jgowdyelastic Aug 26, 2020
d64a389
Merge branch 'master' into switching-to-new-js-client
jgowdyelastic Aug 26, 2020
c57a17c
Merge branch 'master' into switching-to-new-js-client
jgowdyelastic Aug 27, 2020
d01972e
fixing types after master merge
jgowdyelastic Aug 27, 2020
8eabebd
throw error rather than return it
jgowdyelastic Aug 27, 2020
43ba3e8
removing placeholder error
jgowdyelastic Aug 27, 2020
e7a7ed7
changes based on review comments
jgowdyelastic Aug 27, 2020
cdedcc3
Merge branch 'master' into switching-to-new-js-client
jgowdyelastic Sep 1, 2020
7d0b7d3
Merge branch 'master' into switching-to-new-js-client
elasticmachine Sep 1, 2020
dc344c4
fixing types after merge with master
jgowdyelastic Sep 1, 2020
18ccad3
fixing missing return
jgowdyelastic Sep 2, 2020
a7414d4
Merge branch 'master' into switching-to-new-js-client
elasticmachine Sep 2, 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
15 changes: 6 additions & 9 deletions x-pack/plugins/apm/server/lib/helpers/setup_request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,13 @@ function getMlSetup(context: APMRequestHandlerContext, request: KibanaRequest) {
if (!context.plugins.ml) {
return;
}

const ml = context.plugins.ml;
const mlClient = ml.mlClient.asScoped(request);
const client = context.core.elasticsearch.client;
return {
mlSystem: ml.mlSystemProvider(mlClient, request),
anomalyDetectors: ml.anomalyDetectorsProvider(mlClient, request),
modules: ml.modulesProvider(
mlClient,
request,
context.core.savedObjects.client
),
mlClient,
mlSystem: ml.mlSystemProvider(request),
anomalyDetectors: ml.anomalyDetectorsProvider(request),
modules: ml.modulesProvider(request, context.core.savedObjects.client),
client,
};
}
5 changes: 2 additions & 3 deletions x-pack/plugins/infra/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,8 @@ export class InfraServerPlugin {
core.http.registerRouteHandlerContext(
'infra',
(context, request): InfraRequestHandlerContext => {
const mlSystem = context.ml && plugins.ml?.mlSystemProvider(context.ml?.mlClient, request);
const mlAnomalyDetectors =
context.ml && plugins.ml?.anomalyDetectorsProvider(context.ml?.mlClient, request);
const mlSystem = plugins.ml?.mlSystemProvider(request);
const mlAnomalyDetectors = plugins.ml?.anomalyDetectorsProvider(request);
const spaceId = plugins.spaces?.spacesService.getSpaceId(request) || 'default';

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ function title(statuses: Statuses) {
}
}

function ImportError(error: any, key: number) {
const ImportError: FC<{ error: any }> = ({ error }) => {
const errorObj = toString(error);
return (
<React.Fragment>
<p key={key}>{errorObj.msg}</p>
<>
<p>{errorObj.msg}</p>

{errorObj.more !== undefined && (
<EuiAccordion
Expand All @@ -113,9 +113,9 @@ function ImportError(error: any, key: number) {
{errorObj.more}
</EuiAccordion>
)}
</React.Fragment>
</>
);
}
};

function toString(error: any): ImportError {
if (typeof error === 'string') {
Expand All @@ -127,11 +127,11 @@ function toString(error: any): ImportError {
return { msg: error.msg };
} else if (error.error !== undefined) {
if (typeof error.error === 'object') {
if (error.error.msg !== undefined) {
if (error.error.reason !== undefined) {
// this will catch a bulk ingest failure
const errorObj: ImportError = { msg: error.error.msg };
if (error.error.body !== undefined) {
errorObj.more = error.error.response;
const errorObj: ImportError = { msg: error.error.reason };
if (error.error.root_cause !== undefined) {
errorObj.more = JSON.stringify(error.error.root_cause);
}
return errorObj;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ export class ChartLoader {
splitFieldName,
splitFieldValue
);
if (resp.error !== undefined) {
throw resp.error;
}

return resp.results;
}
return {};
Expand Down Expand Up @@ -105,9 +103,7 @@ export class ChartLoader {
aggFieldPairNames,
splitFieldName
);
if (resp.error !== undefined) {
throw resp.error;
}

return resp.results;
}
return {};
Expand Down
60 changes: 0 additions & 60 deletions x-pack/plugins/ml/server/client/elasticsearch_ml.test.ts

This file was deleted.

Loading