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] Transforms: Adds maxRetries:0 to relevant API calls. #144603

Merged
merged 3 commits into from Nov 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 28 additions & 16 deletions x-pack/plugins/transform/server/routes/api/transforms.ts
Expand Up @@ -155,10 +155,13 @@ export function registerTransformsRoutes(routeDependencies: RouteDependencies) {
async (ctx, req, res) => {
try {
const esClient = (await ctx.core).elasticsearch.client;
const body = await esClient.asCurrentUser.transform.getTransformStats({
size: 1000,
transform_id: '_all',
});
const body = await esClient.asCurrentUser.transform.getTransformStats(
{
size: 1000,
transform_id: '_all',
},
{ maxRetries: 0 }
);
return res.ok({ body });
} catch (e) {
return res.customError(wrapError(wrapEsError(e)));
Expand All @@ -185,9 +188,12 @@ export function registerTransformsRoutes(routeDependencies: RouteDependencies) {
const { transformId } = req.params;
try {
const esClient = (await ctx.core).elasticsearch.client;
const body = await esClient.asCurrentUser.transform.getTransformStats({
transform_id: transformId,
});
const body = await esClient.asCurrentUser.transform.getTransformStats(
{
transform_id: transformId,
},
{ maxRetries: 0 }
);
return res.ok({ body });
} catch (e) {
return res.customError(wrapError(wrapEsError(e)));
Expand Down Expand Up @@ -452,7 +458,7 @@ export function registerTransformsRoutes(routeDependencies: RouteDependencies) {
license.guardApiRoute(async (ctx, req, res) => {
try {
const esClient = (await ctx.core).elasticsearch.client;
const body = await esClient.asCurrentUser.search(req.body);
const body = await esClient.asCurrentUser.search(req.body, { maxRetries: 0 });
return res.ok({ body });
} catch (e) {
return res.customError(wrapError(wrapEsError(e)));
Expand Down Expand Up @@ -643,16 +649,22 @@ const previewTransformHandler: RequestHandler<
try {
const reqBody = req.body;
const esClient = (await ctx.core).elasticsearch.client;
const body = await esClient.asCurrentUser.transform.previewTransform({
body: reqBody,
});
const body = await esClient.asCurrentUser.transform.previewTransform(
{
body: reqBody,
},
{ maxRetries: 0 }
);
if (isLatestTransform(reqBody)) {
// for the latest transform mappings properties have to be retrieved from the source
const fieldCapsResponse = await esClient.asCurrentUser.fieldCaps({
index: reqBody.source.index,
fields: '*',
include_unmapped: false,
});
const fieldCapsResponse = await esClient.asCurrentUser.fieldCaps(
{
index: reqBody.source.index,
fields: '*',
include_unmapped: false,
},
{ maxRetries: 0 }
);

const fieldNamesSet = new Set(Object.keys(fieldCapsResponse.fields));

Expand Down