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] Removing ignore_throttled from anomaly detection job results searches #203788

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { omit } from 'lodash';
import type { Aggregation, Datafeed } from '../types/anomaly_detection_jobs';

export function getAggregations<T>(obj: any): T | undefined {
Expand All @@ -18,3 +19,10 @@ export const getDatafeedAggregations = (
): Aggregation | undefined => {
return getAggregations<Aggregation>(datafeedConfig);
};

export function getIndicesOptions(datafeedConfig?: Datafeed) {
// remove ignore_throttled from indices_options to avoid deprecation warnings in the logs
return datafeedConfig?.indices_options
? omit(datafeedConfig.indices_options, 'ignore_throttled')
: {};
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import { getSeverityType } from '@kbn/ml-anomaly-utils';
import { getIndicesOptions } from '../../../../../common/util/datafeed_utils';
import type { MlResultsService } from '../../../services/results_service';
import type { CombinedJobWithStats } from '../../../../../common/types/anomaly_detection_jobs';
import type { Anomaly } from '../../../jobs/new_job/common/results_loader/results_loader';
Expand All @@ -32,7 +33,7 @@ export function chartLoaderProvider(mlResultsService: MlResultsService) {
job.data_counts.latest_record_timestamp!,
intervalMs,
job.datafeed_config.runtime_mappings,
job.datafeed_config.indices_options
getIndicesOptions(job.datafeed_config)
);
if (resp.error !== undefined) {
throw resp.error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { parseInterval } from '@kbn/ml-parse-interval';

import { initCardinalityFieldsCache } from './fields_aggs_cache';
import { isValidAggregationField } from '../../../common/util/validation_utils';
import { getDatafeedAggregations } from '../../../common/util/datafeed_utils';
import { getDatafeedAggregations, getIndicesOptions } from '../../../common/util/datafeed_utils';
import type { Datafeed, IndicesOptions } from '../../../common/types/anomaly_detection_jobs';

/**
Expand Down Expand Up @@ -190,7 +190,7 @@ export function fieldsServiceProvider({ asCurrentUser }: IScopedClusterClient) {
{
index,
body,
...(datafeedConfig?.indices_options ?? {}),
...getIndicesOptions(datafeedConfig),
},
{ maxRetries: 0 }
);
Expand Down Expand Up @@ -418,7 +418,7 @@ export function fieldsServiceProvider({ asCurrentUser }: IScopedClusterClient) {
{
index,
body,
...(datafeedConfig?.indices_options ?? {}),
...getIndicesOptions(datafeedConfig),
},
{ maxRetries: 0 }
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { validateTimeRange, isValidTimeField } from './validate_time_range';
import type { validateJobSchema } from '../../routes/schemas/job_validation_schema';
import type { CombinedJob } from '../../../common/types/anomaly_detection_jobs';
import type { MlClient } from '../../lib/ml_client';
import { getDatafeedAggregations } from '../../../common/util/datafeed_utils';
import { getDatafeedAggregations, getIndicesOptions } from '../../../common/util/datafeed_utils';
import type { AuthorizationHeader } from '../../lib/request_authorization';

export type ValidateJobPayload = TypeOf<typeof validateJobSchema>;
Expand Down Expand Up @@ -74,7 +74,7 @@ export async function validateJob(
timeField,
job.datafeed_config.query,
job.datafeed_config.runtime_mappings,
job.datafeed_config.indices_options
getIndicesOptions(job.datafeed_config)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
ML_JOB_ID,
ML_PARTITION_FIELD_VALUE,
} from '@kbn/ml-anomaly-utils';
import { getIndicesOptions } from '../../../common/util/datafeed_utils';
import { buildAnomalyTableItems } from './build_anomaly_table_items';
import { ANOMALIES_TABLE_DEFAULT_QUERY_SIZE } from '../../../common/constants/search';
import { getPartitionFieldsValuesFactory } from './get_partition_fields_values';
Expand Down Expand Up @@ -727,7 +728,7 @@ export function resultsServiceProvider(mlClient: MlClient, client?: IScopedClust
},
size: 0,
},
...(datafeedConfig?.indices_options ?? {}),
...getIndicesOptions(datafeedConfig),
};

if (client) {
Expand Down
Loading