diff --git a/x-pack/packages/ml/aiops_log_pattern_analysis/schema.ts b/x-pack/packages/ml/aiops_log_pattern_analysis/schema.ts index 72b1dbca38032..05254e72a651c 100644 --- a/x-pack/packages/ml/aiops_log_pattern_analysis/schema.ts +++ b/x-pack/packages/ml/aiops_log_pattern_analysis/schema.ts @@ -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()), }); /** diff --git a/x-pack/packages/ml/aiops_log_rate_analysis/api/schema_v2.ts b/x-pack/packages/ml/aiops_log_rate_analysis/api/schema_v2.ts index 1e132f6f00e78..95c778a118454 100644 --- a/x-pack/packages/ml/aiops_log_rate_analysis/api/schema_v2.ts +++ b/x-pack/packages/ml/aiops_log_rate_analysis/api/schema_v2.ts @@ -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 */ diff --git a/x-pack/packages/ml/aiops_log_rate_analysis/queries/__mocks__/params_match_all.ts b/x-pack/packages/ml/aiops_log_rate_analysis/queries/__mocks__/params_match_all.ts index a81ba523caa43..36d63c883ecd8 100644 --- a/x-pack/packages/ml/aiops_log_rate_analysis/queries/__mocks__/params_match_all.ts +++ b/x-pack/packages/ml/aiops_log_rate_analysis/queries/__mocks__/params_match_all.ts @@ -14,6 +14,5 @@ export const paramsMock = { baselineMax: 20, deviationMin: 30, deviationMax: 40, - includeFrozen: false, searchQuery: '{ "match_all": {} }', }; diff --git a/x-pack/packages/ml/aiops_log_rate_analysis/queries/get_request_base.test.ts b/x-pack/packages/ml/aiops_log_rate_analysis/queries/get_request_base.test.ts deleted file mode 100644 index 33797e219fd37..0000000000000 --- a/x-pack/packages/ml/aiops_log_rate_analysis/queries/get_request_base.test.ts +++ /dev/null @@ -1,25 +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 - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { paramsMock } from './__mocks__/params_match_all'; - -import { getRequestBase } from './get_request_base'; - -describe('getRequestBase', () => { - it('defaults to not setting `ignore_throttled`', () => { - const requestBase = getRequestBase(paramsMock); - expect(requestBase.ignore_throttled).toEqual(undefined); - }); - - it('adds `ignore_throttled=false` when `includeFrozen=true`', () => { - const requestBase = getRequestBase({ - ...paramsMock, - includeFrozen: true, - }); - expect(requestBase.ignore_throttled).toEqual(false); - }); -}); diff --git a/x-pack/packages/ml/aiops_log_rate_analysis/queries/get_request_base.ts b/x-pack/packages/ml/aiops_log_rate_analysis/queries/get_request_base.ts index 8083cb25c12b5..8b16b5c050596 100644 --- a/x-pack/packages/ml/aiops_log_rate_analysis/queries/get_request_base.ts +++ b/x-pack/packages/ml/aiops_log_rate_analysis/queries/get_request_base.ts @@ -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, }); diff --git a/x-pack/packages/ml/json_schemas/src/put___ml_anomaly_detectors__job_id__schema.json b/x-pack/packages/ml/json_schemas/src/put___ml_anomaly_detectors__job_id__schema.json index 79a871f1ef3fa..81e1d22bdad9b 100644 --- a/x-pack/packages/ml/json_schemas/src/put___ml_anomaly_detectors__job_id__schema.json +++ b/x-pack/packages/ml/json_schemas/src/put___ml_anomaly_detectors__job_id__schema.json @@ -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" } } }, @@ -10884,4 +10880,4 @@ } } } -} \ No newline at end of file +} diff --git a/x-pack/packages/ml/json_schemas/src/put___ml_datafeeds__datafeed_id__schema.json b/x-pack/packages/ml/json_schemas/src/put___ml_datafeeds__datafeed_id__schema.json index 575411eb3a8c2..8bf2dbfc1f529 100644 --- a/x-pack/packages/ml/json_schemas/src/put___ml_datafeeds__datafeed_id__schema.json +++ b/x-pack/packages/ml/json_schemas/src/put___ml_datafeeds__datafeed_id__schema.json @@ -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" } } }, @@ -8051,4 +8047,4 @@ } } } -} \ No newline at end of file +} diff --git a/x-pack/plugins/ml/server/models/job_service/jobs.ts b/x-pack/plugins/ml/server/models/job_service/jobs.ts index 9c4ea6b1d3307..fa779258e5f23 100644 --- a/x-pack/plugins/ml/server/models/job_service/jobs.ts +++ b/x-pack/plugins/ml/server/models/job_service/jobs.ts @@ -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) { diff --git a/x-pack/plugins/ml/server/routes/schemas/datafeeds_schema.ts b/x-pack/plugins/ml/server/routes/schemas/datafeeds_schema.ts index 27e1b6afe3364..2c61dca8859b2 100644 --- a/x-pack/plugins/ml/server/routes/schemas/datafeeds_schema.ts +++ b/x-pack/plugins/ml/server/routes/schemas/datafeeds_schema.ts @@ -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({ diff --git a/x-pack/test/functional/apps/ml/anomaly_detection_result_views/aggregated_scripted_job.ts b/x-pack/test/functional/apps/ml/anomaly_detection_result_views/aggregated_scripted_job.ts index d2171544aa993..0d27f9afe153b 100644 --- a/x-pack/test/functional/apps/ml/anomaly_detection_result_views/aggregated_scripted_job.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection_result_views/aggregated_scripted_job.ts @@ -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: {}, @@ -140,7 +139,6 @@ export default function ({ getService }: FtrProviderContext) { expand_wildcards: ['open'], ignore_unavailable: false, allow_no_indices: true, - ignore_throttled: true, }, query: { bool: { @@ -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: {}, @@ -317,7 +314,6 @@ export default function ({ getService }: FtrProviderContext) { expand_wildcards: ['open'], ignore_unavailable: false, allow_no_indices: true, - ignore_throttled: true, }, query: { bool: {