Skip to content

Commit

Permalink
[ML] Removing use of ignore_throttled (elastic#199107)
Browse files Browse the repository at this point in the history
`ignore_throttled` is being removed, we can remove it from the various
searches we run.

I'm leaving it in the schema for the datafeed config for now, just in
case we have a situation where a very old job is used in the UI with an
endpoint which validates the datafeed config. Even though the setting
would be ignored, we don't want the route to reject the datafeed because
it doesn't know what `ignore_throttled` is.

When cloning very old jobs jobs, I'm removing `ignore_throttled` from
the `indices_options`

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
2 people authored and CAWilson94 committed Dec 12, 2024
1 parent b33fae3 commit af45ab8
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 43 deletions.
1 change: 0 additions & 1 deletion x-pack/packages/ml/aiops_log_pattern_analysis/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export const indicesOptionsSchema = schema.object({
),
ignore_unavailable: schema.maybe(schema.boolean()),
allow_no_indices: schema.maybe(schema.boolean()),
ignore_throttled: schema.maybe(schema.boolean()),
});

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const aiopsLogRateAnalysisBase = schema.object({
end: schema.number(),
searchQuery: schema.string(),
timeFieldName: schema.string(),
// when v2 is removed, includeFrozen should not carry over to v3+
includeFrozen: schema.maybe(schema.boolean()),
grouping: schema.maybe(schema.boolean()),
/** Analysis selection time ranges */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ export const paramsMock = {
baselineMax: 20,
deviationMin: 30,
deviationMax: 40,
includeFrozen: false,
searchQuery: '{ "match_all": {} }',
};

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

import type { AiopsLogRateAnalysisSchema } from '../api/schema';

export const getRequestBase = ({ index, includeFrozen }: AiopsLogRateAnalysisSchema) => ({
export const getRequestBase = ({ index }: AiopsLogRateAnalysisSchema) => ({
index,
...(includeFrozen ? { ignore_throttled: false } : {}),
ignore_unavailable: true,
});
Original file line number Diff line number Diff line change
Expand Up @@ -10765,10 +10765,6 @@
"ignore_unavailable": {
"description": "If true, missing or closed indices are not included in the response.",
"type": "boolean"
},
"ignore_throttled": {
"description": "If true, concrete, expanded or aliased indices are ignored when frozen.",
"type": "boolean"
}
}
},
Expand Down Expand Up @@ -10884,4 +10880,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7932,10 +7932,6 @@
"ignore_unavailable": {
"description": "If true, missing or closed indices are not included in the response.",
"type": "boolean"
},
"ignore_throttled": {
"description": "If true, concrete, expanded or aliased indices are ignored when frozen.",
"type": "boolean"
}
}
},
Expand Down Expand Up @@ -8051,4 +8047,4 @@
}
}
}
}
}
4 changes: 4 additions & 0 deletions x-pack/plugins/ml/server/models/job_service/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@ export function jobsProvider(
const result: { datafeed?: Datafeed; job?: Job } = { job: undefined, datafeed: undefined };
if (datafeedResult && datafeedResult.job_id === jobId) {
result.datafeed = datafeedResult;
if (result.datafeed.indices_options?.ignore_throttled !== undefined) {
// ignore_throttled is a deprecated setting, remove it from the response
delete result.datafeed.indices_options.ignore_throttled;
}
}

if (jobResults?.jobs?.length > 0) {
Expand Down
3 changes: 3 additions & 0 deletions x-pack/plugins/ml/server/routes/schemas/datafeeds_schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export const indicesOptionsSchema = schema.object({
),
ignore_unavailable: schema.maybe(schema.boolean()),
allow_no_indices: schema.maybe(schema.boolean()),
// retaining the deprecated ignore_throttled in case an older jobs are used
// we don't want to fail the schema validation if this is present
ignore_throttled: schema.maybe(schema.boolean()),
failure_store: schema.maybe(schema.string()),
});

export const datafeedConfigSchema = schema.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export default function ({ getService }: FtrProviderContext) {
expand_wildcards: ['open'],
ignore_unavailable: false,
allow_no_indices: true,
ignore_throttled: true,
},
query: {
match_all: {},
Expand Down Expand Up @@ -140,7 +139,6 @@ export default function ({ getService }: FtrProviderContext) {
expand_wildcards: ['open'],
ignore_unavailable: false,
allow_no_indices: true,
ignore_throttled: true,
},
query: {
bool: {
Expand Down Expand Up @@ -217,7 +215,6 @@ export default function ({ getService }: FtrProviderContext) {
expand_wildcards: ['open'],
ignore_unavailable: false,
allow_no_indices: true,
ignore_throttled: true,
},
query: {
match_all: {},
Expand Down Expand Up @@ -317,7 +314,6 @@ export default function ({ getService }: FtrProviderContext) {
expand_wildcards: ['open'],
ignore_unavailable: false,
allow_no_indices: true,
ignore_throttled: true,
},
query: {
bool: {
Expand Down

0 comments on commit af45ab8

Please sign in to comment.