From 68a924411b9d88eb39b8f0b47b4ee22acab3f729 Mon Sep 17 00:00:00 2001 From: "elastic-renovate-prod[bot]" <174716857+elastic-renovate-prod[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 12:48:10 -0500 Subject: [PATCH] Update dependency @elastic/elasticsearch to ^8.15.0 (main) (#190378) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Alejandro Fernández Haro Co-authored-by: Walter Rafelsberger --- package.json | 2 +- .../src/mapping_definition.ts | 34 +++---- .../filters/build_filters/phrase_filter.ts | 4 +- .../src/filters/build_filters/range_filter.ts | 4 +- .../src/containers/query/types.ts | 4 +- .../combined_fields/semantic_text.tsx | 8 +- .../data_drift/use_data_drift_result.ts | 2 - .../plugins/data_visualizer/server/routes.ts | 3 +- .../components/search_index/index_error.tsx | 1 - .../details_step/additional_section.tsx | 2 +- .../hooks/use_create_analytics_form/state.ts | 3 +- .../explorer/explorer_dashboard_service.ts | 2 +- .../ml_api_service/data_frame_analytics.ts | 2 +- .../ml_api_service/inference_models.ts | 11 +-- .../lib/alerts/jobs_health_service.test.ts | 2 +- .../model_management/models_provider.ts | 12 +-- .../ml/server/routes/inference_models.ts | 7 +- .../lib/requests/get_ping_histogram.ts | 2 - x-pack/plugins/rule_registry/common/types.ts | 3 +- .../server/alert_data_client/alerts_client.ts | 23 ++--- .../tests/remove_cases_from_alerts.test.ts | 94 +++++++++---------- .../lib/delete_inference_endpoint.test.ts | 4 +- .../server/lib/delete_inference_endpoint.ts | 2 +- .../common/detection_engine/types.ts | 7 +- .../task_manager/server/task_store.test.ts | 2 +- .../expanded_row_details_pane.tsx | 23 ++++- yarn.lock | 27 +++--- 27 files changed, 145 insertions(+), 145 deletions(-) diff --git a/package.json b/package.json index 27a009189f475..31d8046160403 100644 --- a/package.json +++ b/package.json @@ -113,7 +113,7 @@ "@elastic/datemath": "5.0.3", "@elastic/ebt": "1.0.0", "@elastic/ecs": "^8.11.1", - "@elastic/elasticsearch": "^8.14.0", + "@elastic/elasticsearch": "^8.15.0", "@elastic/ems-client": "8.5.3", "@elastic/eui": "95.7.0", "@elastic/filesaver": "1.1.2", diff --git a/packages/core/saved-objects/core-saved-objects-server/src/mapping_definition.ts b/packages/core/saved-objects/core-saved-objects-server/src/mapping_definition.ts index 80ba357009530..0dfc9d2ea05e2 100644 --- a/packages/core/saved-objects/core-saved-objects-server/src/mapping_definition.ts +++ b/packages/core/saved-objects/core-saved-objects-server/src/mapping_definition.ts @@ -9,6 +9,7 @@ import type { PropertyName as EsPropertyName, MappingProperty as EsMappingProperty, + MappingPropertyBase as EsMappingPropertyBase, } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; /** @@ -64,19 +65,20 @@ export interface SavedObjectsMappingProperties { * * @public */ -export type SavedObjectsFieldMapping = EsMappingProperty & { - /** - * The dynamic property of the mapping, either `false` or `'strict'`. If - * unspecified `dynamic: 'strict'` will be inherited from the top-level - * index mappings. - * - * Note: To limit the number of mapping fields Saved Object types should - * *never* use `dynamic: true`. - */ - dynamic?: false | 'strict'; - /** - * Some mapping types do not accept the `properties` attributes. Explicitly adding it as optional to our type - * to avoid type failures on all code using accessing them via `SavedObjectsFieldMapping.properties`. - */ - properties?: Record; -}; +export type SavedObjectsFieldMapping = EsMappingProperty & + EsMappingPropertyBase & { + /** + * The dynamic property of the mapping, either `false` or `'strict'`. If + * unspecified `dynamic: 'strict'` will be inherited from the top-level + * index mappings. + * + * Note: To limit the number of mapping fields Saved Object types should + * *never* use `dynamic: true`. + */ + dynamic?: false | 'strict'; + /** + * Some mapping types do not accept the `properties` attributes. Explicitly adding it as optional to our type + * to avoid type failures on all code using accessing them via `SavedObjectsFieldMapping.properties`. + */ + properties?: Record; + }; diff --git a/packages/kbn-es-query/src/filters/build_filters/phrase_filter.ts b/packages/kbn-es-query/src/filters/build_filters/phrase_filter.ts index 485a10fddb038..63ff39e467aef 100644 --- a/packages/kbn-es-query/src/filters/build_filters/phrase_filter.ts +++ b/packages/kbn-es-query/src/filters/build_filters/phrase_filter.ts @@ -37,7 +37,7 @@ export type ScriptedPhraseFilter = Filter & { meta: PhraseFilterMeta; query: { script: { - script: estypes.InlineScript; + script: estypes.Script; }; }; }; @@ -134,7 +134,7 @@ export const getPhraseScript = (field: DataViewFieldBase, value: PhraseFilterVal params: { value: convertedValue, }, - } as estypes.InlineScript, + } as estypes.Script, }; }; diff --git a/packages/kbn-es-query/src/filters/build_filters/range_filter.ts b/packages/kbn-es-query/src/filters/build_filters/range_filter.ts index f80fce31cb8ae..46a36b5c49994 100644 --- a/packages/kbn-es-query/src/filters/build_filters/range_filter.ts +++ b/packages/kbn-es-query/src/filters/build_filters/range_filter.ts @@ -65,7 +65,7 @@ export type ScriptedRangeFilter = Filter & { meta: RangeFilterMeta; query: { script: { - script: estypes.InlineScript; + script: estypes.Script; }; }; }; @@ -189,7 +189,7 @@ export const buildRangeFilter = ( * @internal */ export const getRangeScript = (field: DataViewFieldBase, params: RangeFilterParams) => { - const knownParams: estypes.InlineScript['params'] = mapValues( + const knownParams: estypes.Script['params'] = mapValues( pickBy(params, (val, key) => key in operators), (value) => (field.type === 'number' && typeof value === 'string' ? parseFloat(value) : value) ); diff --git a/packages/kbn-grouping/src/containers/query/types.ts b/packages/kbn-grouping/src/containers/query/types.ts index 69a284ecf7a59..c50e4f8b3391a 100644 --- a/packages/kbn-grouping/src/containers/query/types.ts +++ b/packages/kbn-grouping/src/containers/query/types.ts @@ -7,7 +7,7 @@ */ import type { - InlineScript, + Script, MappingRuntimeField, MappingRuntimeFields, } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; @@ -52,7 +52,7 @@ export interface MainAggregation extends NamedAggregation { } export interface GroupingRuntimeField extends MappingRuntimeField { - script: InlineScript & { + script: Script & { params: Record; }; } diff --git a/x-pack/plugins/data_visualizer/public/application/common/components/combined_fields/semantic_text.tsx b/x-pack/plugins/data_visualizer/public/application/common/components/combined_fields/semantic_text.tsx index 581e92d23dc9d..5ec9216f599c6 100644 --- a/x-pack/plugins/data_visualizer/public/application/common/components/combined_fields/semantic_text.tsx +++ b/x-pack/plugins/data_visualizer/public/application/common/components/combined_fields/semantic_text.tsx @@ -25,7 +25,7 @@ import { FormattedMessage } from '@kbn/i18n-react'; import { cloneDeep } from 'lodash'; import useDebounce from 'react-use/lib/useDebounce'; import type { - InferenceModelConfigContainer, + InferenceInferenceEndpointInfo, MappingTypeMapping, } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { createSemanticTextCombinedField, getFieldNames, getNameCollisionMsg } from './utils'; @@ -61,14 +61,14 @@ export const SemanticTextForm: FC = ({ addCombinedField, hasNameCollision useEffect(() => { http - .fetch('/internal/data_visualizer/inference_services', { + .fetch('/internal/data_visualizer/inference_services', { method: 'GET', version: '1', }) .then((response) => { const inferenceServiceOptions = response.map((service) => ({ - value: service.model_id, - text: service.model_id, + value: service.inference_id, + text: service.inference_id, })); setInferenceServices(inferenceServiceOptions); setSelectedInference(inferenceServiceOptions[0]?.value ?? undefined); diff --git a/x-pack/plugins/data_visualizer/public/application/data_drift/use_data_drift_result.ts b/x-pack/plugins/data_visualizer/public/application/data_drift/use_data_drift_result.ts index b16bb4394edf1..158b3477b5cb1 100644 --- a/x-pack/plugins/data_visualizer/public/application/data_drift/use_data_drift_result.ts +++ b/x-pack/plugins/data_visualizer/public/application/data_drift/use_data_drift_result.ts @@ -304,10 +304,8 @@ const getDataComparisonQuery = ({ if (rangeFilter && isPopulatedObject(query, ['bool'])) { if (Array.isArray(query.bool.filter)) { - // @ts-expect-error gte and lte can be numeric query.bool.filter.push(rangeFilter); } else { - // @ts-expect-error gte and lte can be numeric query.bool.filter = [rangeFilter]; } } diff --git a/x-pack/plugins/data_visualizer/server/routes.ts b/x-pack/plugins/data_visualizer/server/routes.ts index a21f1ed93c1d3..05234fc5583ee 100644 --- a/x-pack/plugins/data_visualizer/server/routes.ts +++ b/x-pack/plugins/data_visualizer/server/routes.ts @@ -83,8 +83,7 @@ export function routes(coreSetup: CoreSetup, logger: Logger) async (context, request, response) => { try { const esClient = (await context.core).elasticsearch.client; - // @ts-expect-error types are wrong - const { endpoints } = await esClient.asCurrentUser.inference.getModel({ + const { endpoints } = await esClient.asCurrentUser.inference.get({ inference_id: '_all', }); diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/index_error.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/index_error.tsx index 38d50c9a731fd..49a3ca412a547 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/index_error.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/index_error.tsx @@ -50,7 +50,6 @@ const getSemanticTextFields = ( return Object.entries(fields).flatMap(([key, value]) => { const currentPath: string = path ? `${path}.${key}` : key; const currentField: Array<{ path: string; source: SemanticTextProperty }> = - // @ts-expect-error because semantic_text type isn't incorporated in API type yet value.type === 'semantic_text' ? [{ path: currentPath, source: value }] : []; if (hasProperties(value)) { const childSemanticTextFields: Array<{ path: string; source: SemanticTextProperty }> = diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/details_step/additional_section.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/details_step/additional_section.tsx index b9f59c60fc41b..22bdb1d2aface 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/details_step/additional_section.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/details_step/additional_section.tsx @@ -11,7 +11,7 @@ import { i18n } from '@kbn/i18n'; import { EuiAccordion, EuiSpacer } from '@elastic/eui'; import type { MlUrlConfig } from '@kbn/ml-anomaly-utils'; import type { DataFrameAnalyticsConfig } from '@kbn/ml-data-frame-analytics-utils'; -import type { DeepPartial } from '../../../../../../../common/types/common'; +import type { DeepPartial } from '@kbn/utility-types'; import { Description } from './description'; import { CustomUrlsWrapper } from '../../../../../components/custom_urls'; import { diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/state.ts b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/state.ts index 7b377bda9fa71..53bb2d3ceb4d1 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/state.ts +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/state.ts @@ -16,7 +16,8 @@ import { type DataFrameAnalysisConfigType, type FeatureProcessor, } from '@kbn/ml-data-frame-analytics-utils'; -import type { DeepPartial, DeepReadonly } from '../../../../../../../common/types/common'; +import type { DeepPartial } from '@kbn/utility-types'; +import type { DeepReadonly } from '../../../../../../../common/types/common'; import { checkPermission } from '../../../../../capabilities/check_capabilities'; import { mlNodesAvailable } from '../../../../../ml_nodes_check'; diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_dashboard_service.ts b/x-pack/plugins/ml/public/application/explorer/explorer_dashboard_service.ts index a26a500892727..1bcef70b54c25 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_dashboard_service.ts +++ b/x-pack/plugins/ml/public/application/explorer/explorer_dashboard_service.ts @@ -14,7 +14,7 @@ import { isEqual } from 'lodash'; import type { Observable } from 'rxjs'; import { from, isObservable, Subject } from 'rxjs'; import { distinctUntilChanged, flatMap, scan, shareReplay } from 'rxjs'; -import type { DeepPartial } from '../../../common/types/common'; +import type { DeepPartial } from '@kbn/utility-types'; import { jobSelectionActionCreator } from './actions'; import { EXPLORER_ACTION } from './explorer_constants'; import type { ExplorerState } from './reducers'; diff --git a/x-pack/plugins/ml/public/application/services/ml_api_service/data_frame_analytics.ts b/x-pack/plugins/ml/public/application/services/ml_api_service/data_frame_analytics.ts index 2e7883b80b558..e9b2e914fabe3 100644 --- a/x-pack/plugins/ml/public/application/services/ml_api_service/data_frame_analytics.ts +++ b/x-pack/plugins/ml/public/application/services/ml_api_service/data_frame_analytics.ts @@ -7,6 +7,7 @@ import { useMemo } from 'react'; +import type { DeepPartial } from '@kbn/utility-types'; import type { NewJobCapsResponse } from '@kbn/ml-anomaly-utils'; import type { AnalyticsMapReturnType, @@ -21,7 +22,6 @@ import type { HttpService } from '../http_service'; import { useMlKibana } from '../../contexts/kibana'; import type { ValidateAnalyticsJobResponse } from '../../../../common/constants/validation'; -import type { DeepPartial } from '../../../../common/types/common'; import type { JobMessage } from '../../../../common/types/audit_message'; import type { PutDataFrameAnalyticsResponseSchema } from '../../../../server/routes/schemas/data_frame_analytics_schema'; diff --git a/x-pack/plugins/ml/public/application/services/ml_api_service/inference_models.ts b/x-pack/plugins/ml/public/application/services/ml_api_service/inference_models.ts index e60bc99d84bd2..140c373f95715 100644 --- a/x-pack/plugins/ml/public/application/services/ml_api_service/inference_models.ts +++ b/x-pack/plugins/ml/public/application/services/ml_api_service/inference_models.ts @@ -11,11 +11,6 @@ import type { ModelConfig } from '@kbn/inference_integration_flyout/types'; import type { HttpService } from '../http_service'; import { ML_INTERNAL_BASE_PATH } from '../../../../common/constants/app'; -// TODO remove inference_id when esType has been updated to include it -export interface GetInferenceEndpointsResponse extends estypes.InferenceModelConfigContainer { - inference_id: string; -} - export function inferenceModelsApiProvider(httpService: HttpService) { return { /** @@ -29,7 +24,7 @@ export function inferenceModelsApiProvider(httpService: HttpService) { taskType: InferenceTaskType, modelConfig: ModelConfig ) { - const result = await httpService.http({ + const result = await httpService.http({ path: `${ML_INTERNAL_BASE_PATH}/_inference/${taskType}/${inferenceId}`, method: 'PUT', body: JSON.stringify(modelConfig), @@ -41,9 +36,7 @@ export function inferenceModelsApiProvider(httpService: HttpService) { * Gets all inference endpoints */ async getAllInferenceEndpoints() { - const result = await httpService.http<{ - endpoints: GetInferenceEndpointsResponse[]; - }>({ + const result = await httpService.http({ path: `${ML_INTERNAL_BASE_PATH}/_inference/all`, method: 'GET', version: '1', diff --git a/x-pack/plugins/ml/server/lib/alerts/jobs_health_service.test.ts b/x-pack/plugins/ml/server/lib/alerts/jobs_health_service.test.ts index 18848377ee31b..73010d5dcead4 100644 --- a/x-pack/plugins/ml/server/lib/alerts/jobs_health_service.test.ts +++ b/x-pack/plugins/ml/server/lib/alerts/jobs_health_service.test.ts @@ -9,12 +9,12 @@ import type { JobsHealthService } from './jobs_health_service'; import { jobsHealthServiceProvider } from './jobs_health_service'; import type { DatafeedsService } from '../../models/job_service/datafeeds'; import type { Logger } from '@kbn/core/server'; +import type { DeepPartial } from '@kbn/utility-types'; import type { MlClient } from '../ml_client'; import type { MlJob, MlJobStats } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import type { AnnotationService } from '../../models/annotation_service/annotation'; import type { JobsHealthExecutorOptions } from './register_jobs_monitoring_rule_type'; import type { JobAuditMessagesService } from '../../models/job_audit_messages/job_audit_messages'; -import type { DeepPartial } from '../../../common/types/common'; import type { FieldFormatsRegistryProvider } from '../../../common/types/kibana'; const MOCK_DATE_NOW = 1487076708000; diff --git a/x-pack/plugins/ml/server/models/model_management/models_provider.ts b/x-pack/plugins/ml/server/models/model_management/models_provider.ts index 3345c18ea2b55..1c175cee26d14 100644 --- a/x-pack/plugins/ml/server/models/model_management/models_provider.ts +++ b/x-pack/plugins/ml/server/models/model_management/models_provider.ts @@ -10,7 +10,7 @@ import type { IScopedClusterClient } from '@kbn/core/server'; import { JOB_MAP_NODE_TYPES, type MapElements } from '@kbn/ml-data-frame-analytics-utils'; import { flatten } from 'lodash'; import type { - InferenceModelConfig, + InferenceInferenceEndpoint, InferenceTaskType, TasksTaskInfo, TransformGetTransformTransformSummary, @@ -591,19 +591,19 @@ export class ModelsProvider { * Puts the requested Inference endpoint id into elasticsearch, triggering elasticsearch to create the inference endpoint id * @param inferenceId - Inference Endpoint Id * @param taskType - Inference Task type. Either sparse_embedding or text_embedding - * @param modelConfig - Model configuration based on service type + * @param inferenceConfig - Model configuration based on service type */ async createInferenceEndpoint( inferenceId: string, taskType: InferenceTaskType, - modelConfig: InferenceModelConfig + inferenceConfig: InferenceInferenceEndpoint ) { try { - const result = await this._client.asCurrentUser.inference.putModel( + const result = await this._client.asCurrentUser.inference.put( { inference_id: inferenceId, task_type: taskType, - model_config: modelConfig, + inference_config: inferenceConfig, }, { maxRetries: 0 } ); @@ -613,7 +613,7 @@ export class ModelsProvider { // Erroring out is misleading in these cases, so we return the model_id and task_type if (error.name === 'TimeoutError') { return { - model_id: modelConfig.service, + model_id: inferenceConfig.service, task_type: taskType, }; } else { diff --git a/x-pack/plugins/ml/server/routes/inference_models.ts b/x-pack/plugins/ml/server/routes/inference_models.ts index 21ce595b691c7..d51645a365c62 100644 --- a/x-pack/plugins/ml/server/routes/inference_models.ts +++ b/x-pack/plugins/ml/server/routes/inference_models.ts @@ -6,7 +6,10 @@ */ import type { CloudSetup } from '@kbn/cloud-plugin/server'; import { schema } from '@kbn/config-schema'; -import type { InferenceModelConfig, InferenceTaskType } from '@elastic/elasticsearch/lib/api/types'; +import type { + InferenceInferenceEndpoint, + InferenceTaskType, +} from '@elastic/elasticsearch/lib/api/types'; import type { InferenceAPIConfigResponse } from '@kbn/ml-trained-models-utils'; import type { RouteInitialization } from '../types'; import { createInferenceSchema } from './schemas/inference_schema'; @@ -46,7 +49,7 @@ export function inferenceModelRoutes( const body = await modelsProvider(client, mlClient, cloud).createInferenceEndpoint( inferenceId, taskType as InferenceTaskType, - request.body as InferenceModelConfig + request.body as InferenceInferenceEndpoint ); const { syncSavedObjects } = syncSavedObjectsFactory(client, mlSavedObjectService); await syncSavedObjects(false); diff --git a/x-pack/plugins/observability_solution/uptime/server/legacy_uptime/lib/requests/get_ping_histogram.ts b/x-pack/plugins/observability_solution/uptime/server/legacy_uptime/lib/requests/get_ping_histogram.ts index d7e4372b0a100..192c77bbb0c32 100644 --- a/x-pack/plugins/observability_solution/uptime/server/legacy_uptime/lib/requests/get_ping_histogram.ts +++ b/x-pack/plugins/observability_solution/uptime/server/legacy_uptime/lib/requests/get_ping_histogram.ts @@ -50,7 +50,6 @@ export const getPingHistogram: UMElasticsearchQueryFn< body: { query: { bool: { - // @ts-expect-error upgrade typescript v5.1.6 filter: [...filter, SUMMARY_FILTER, EXCLUDE_RUN_ONCE_FILTER], }, }, @@ -81,7 +80,6 @@ export const getPingHistogram: UMElasticsearchQueryFn< }); const { body: result } = await uptimeEsClient.search(params, 'getPingsOverTime'); - // @ts-expect-error upgrade typescript v5.1.6 const buckets = result?.aggregations?.timeseries?.buckets ?? []; const histogram = buckets.map((bucket: Pick<(typeof buckets)[0], 'key' | 'down' | 'up'>) => { diff --git a/x-pack/plugins/rule_registry/common/types.ts b/x-pack/plugins/rule_registry/common/types.ts index 5f759cac63b31..684160bf904d2 100644 --- a/x-pack/plugins/rule_registry/common/types.ts +++ b/x-pack/plugins/rule_registry/common/types.ts @@ -367,7 +367,8 @@ const allowedFilterKeysSchema = t.union([ t.literal('range'), t.literal('rank_feature'), t.literal('regexp'), - t.literal('rule_query'), + t.literal('rule'), + t.literal('semantic'), t.literal('shape'), t.literal('simple_query_string'), t.literal('span_containing'), diff --git a/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts b/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts index 8d61b2b4e5609..ea80a365ccd95 100644 --- a/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts +++ b/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts @@ -30,7 +30,6 @@ import { AggregateName, AggregationsAggregate, AggregationsMultiBucketAggregateBase, - InlineScript, MappingRuntimeFields, QueryDslQueryContainer, SortCombinations, @@ -826,18 +825,16 @@ export class AlertsClient { const result = await this.esClient.updateByQuery({ index, conflicts: 'proceed', - body: { - script: { - source: `if (ctx._source['${ALERT_WORKFLOW_STATUS}'] != null) { + script: { + source: `if (ctx._source['${ALERT_WORKFLOW_STATUS}'] != null) { ctx._source['${ALERT_WORKFLOW_STATUS}'] = '${status}' } if (ctx._source.signal != null && ctx._source.signal.status != null) { ctx._source.signal.status = '${status}' }`, - lang: 'painless', - } as InlineScript, - query: fetchAndAuditResponse.authorizedQuery as Omit, + lang: 'painless', }, + query: fetchAndAuditResponse.authorizedQuery as Omit, ignore_unavailable: true, }); return result; @@ -965,14 +962,12 @@ export class AlertsClient { await this.esClient.updateByQuery({ index, conflicts: 'proceed', - body: { - script: { - source: painlessScript, - lang: 'painless', - params: { caseIds }, - } as InlineScript, - query: esQuery, + script: { + source: painlessScript, + lang: 'painless', + params: { caseIds }, }, + query: esQuery, ignore_unavailable: true, }); } catch (err) { diff --git a/x-pack/plugins/rule_registry/server/alert_data_client/tests/remove_cases_from_alerts.test.ts b/x-pack/plugins/rule_registry/server/alert_data_client/tests/remove_cases_from_alerts.test.ts index 317de5d52e8e2..84a152258a450 100644 --- a/x-pack/plugins/rule_registry/server/alert_data_client/tests/remove_cases_from_alerts.test.ts +++ b/x-pack/plugins/rule_registry/server/alert_data_client/tests/remove_cases_from_alerts.test.ts @@ -105,56 +105,58 @@ describe('remove cases from alerts', () => { expect(esClientMock.updateByQuery.mock.calls[0][0]).toMatchInlineSnapshot(` Object { - "body": Object { - "query": Object { - "bool": Object { - "filter": Array [ - Object { - "bool": Object { - "minimum_should_match": 1, - "should": Array [ - Object { - "bool": Object { - "minimum_should_match": 1, - "should": Array [ - Object { - "match": Object { - "kibana.alert.case_ids": "test-case-1", - }, + "conflicts": "proceed", + "ignore_unavailable": true, + "index": "undefined-*", + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match": Object { + "kibana.alert.case_ids": "test-case-1", }, - ], - }, + }, + ], }, - Object { - "bool": Object { - "minimum_should_match": 1, - "should": Array [ - Object { - "match": Object { - "kibana.alert.case_ids": "test-case-2", - }, + }, + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match": Object { + "kibana.alert.case_ids": "test-case-2", }, - ], - }, + }, + ], }, - ], - }, + }, + ], }, - ], - "must": Array [], - "must_not": Array [], - "should": Array [], - }, + }, + ], + "must": Array [], + "must_not": Array [], + "should": Array [], }, - "script": Object { - "lang": "painless", - "params": Object { - "caseIds": Array [ - "test-case-1", - "test-case-2", - ], - }, - "source": "if (ctx._source['kibana.alert.case_ids'] != null && ctx._source['kibana.alert.case_ids'].length > 0 && params['caseIds'] != null && params['caseIds'].length > 0) { + }, + "script": Object { + "lang": "painless", + "params": Object { + "caseIds": Array [ + "test-case-1", + "test-case-2", + ], + }, + "source": "if (ctx._source['kibana.alert.case_ids'] != null && ctx._source['kibana.alert.case_ids'].length > 0 && params['caseIds'] != null && params['caseIds'].length > 0) { List storedCaseIds = ctx._source['kibana.alert.case_ids']; List caseIdsToRemove = params['caseIds']; @@ -165,11 +167,7 @@ describe('remove cases from alerts', () => { } } }", - }, }, - "conflicts": "proceed", - "ignore_unavailable": true, - "index": "undefined-*", } `); }); diff --git a/x-pack/plugins/search_inference_endpoints/server/lib/delete_inference_endpoint.test.ts b/x-pack/plugins/search_inference_endpoints/server/lib/delete_inference_endpoint.test.ts index 1715a2a240608..15ea49825f096 100644 --- a/x-pack/plugins/search_inference_endpoints/server/lib/delete_inference_endpoint.test.ts +++ b/x-pack/plugins/search_inference_endpoints/server/lib/delete_inference_endpoint.test.ts @@ -13,7 +13,7 @@ describe('deleteInferenceEndpoint', () => { beforeEach(() => { mockClient = { inference: { - deleteModel: jest.fn(), + delete: jest.fn(), }, }; }); @@ -24,7 +24,7 @@ describe('deleteInferenceEndpoint', () => { await deleteInferenceEndpoint(mockClient, type, id); - expect(mockClient.inference.deleteModel).toHaveBeenCalledWith({ + expect(mockClient.inference.delete).toHaveBeenCalledWith({ inference_id: id, task_type: type, }); diff --git a/x-pack/plugins/search_inference_endpoints/server/lib/delete_inference_endpoint.ts b/x-pack/plugins/search_inference_endpoints/server/lib/delete_inference_endpoint.ts index 1bd6592488151..561a1f4f157ab 100644 --- a/x-pack/plugins/search_inference_endpoints/server/lib/delete_inference_endpoint.ts +++ b/x-pack/plugins/search_inference_endpoints/server/lib/delete_inference_endpoint.ts @@ -19,6 +19,6 @@ export const deleteInferenceEndpoint = async ( id: string ) => { if (isTaskType(type)) { - return await client.inference.deleteModel({ inference_id: id, task_type: type }); + return await client.inference.delete({ inference_id: id, task_type: type }); } }; diff --git a/x-pack/plugins/security_solution/common/detection_engine/types.ts b/x-pack/plugins/security_solution/common/detection_engine/types.ts index 0d87a7e0f8755..4ec806b7e81c1 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/types.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/types.ts @@ -5,6 +5,8 @@ * 2.0. */ +import type { EqlHitsSequence } from '@elastic/elasticsearch/lib/api/types'; + /** * Defines the search types you can have from Elasticsearch within a * doc._source. It uses recursive types of "| SearchTypes[]" to designate @@ -32,10 +34,7 @@ export interface BaseHit { fields?: Record; } -export interface EqlSequence { - join_keys: SearchTypes[]; - events: Array>; -} +export type EqlSequence = EqlHitsSequence; export interface EqlSearchResponse { is_partial: boolean; diff --git a/x-pack/plugins/task_manager/server/task_store.test.ts b/x-pack/plugins/task_manager/server/task_store.test.ts index 9bc1a64140647..80c1f46f53e4d 100644 --- a/x-pack/plugins/task_manager/server/task_store.test.ts +++ b/x-pack/plugins/task_manager/server/task_store.test.ts @@ -1406,7 +1406,7 @@ describe('TaskStore', () => { childEsClient.updateByQuery.mockResponse({ hits: { hits: [], total: 0, updated: 100, version_conflicts: 0 }, } as UpdateByQueryResponse); - await store.updateByQuery({ script: '' }, { max_docs: 10 }); + await store.updateByQuery({ script: { source: '' } }, { max_docs: 10 }); expect(childEsClient.updateByQuery).toHaveBeenCalledWith(expect.any(Object), { requestTimeout: 1000, }); diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_details_pane.tsx b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_details_pane.tsx index 7e3b609b9ffe6..6cbd3da1bbe73 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_details_pane.tsx +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_details_pane.tsx @@ -28,6 +28,13 @@ import { TransformHealthColoredDot } from './transform_health_colored_dot'; import type { SectionConfig, SectionItem } from './expanded_row_column_view'; import { ExpandedRowColumnView } from './expanded_row_column_view'; +const notAvailableMessage = i18n.translate( + 'xpack.transform.transformList.transformDetails.notAvailable', + { + defaultMessage: 'n/a', + } +); + interface ExpandedRowDetailsPaneProps { item: TransformListRow; onAlertEdit: (alertRule: TransformHealthAlertRule) => void; @@ -166,17 +173,23 @@ export const ExpandedRowDetailsPane: FC = ({ item, if (displayStats.checkpointing.next.checkpoint_progress !== undefined) { checkpointingItems.push({ title: 'next.checkpoint_progress.total_docs', - description: displayStats.checkpointing.next.checkpoint_progress.total_docs, + description: + displayStats.checkpointing.next.checkpoint_progress.total_docs ?? notAvailableMessage, }); checkpointingItems.push({ title: 'next.checkpoint_progress.docs_remaining', - description: displayStats.checkpointing.next.checkpoint_progress.docs_remaining, + description: + displayStats.checkpointing.next.checkpoint_progress.docs_remaining ?? + notAvailableMessage, }); checkpointingItems.push({ title: 'next.checkpoint_progress.percent_complete', - description: `${Math.round( - displayStats.checkpointing.next.checkpoint_progress.percent_complete - )}%`, + description: + typeof displayStats.checkpointing.next.checkpoint_progress.percent_complete === 'number' + ? `${Math.round( + displayStats.checkpointing.next.checkpoint_progress.percent_complete + )}%` + : notAvailableMessage, }); } } diff --git a/yarn.lock b/yarn.lock index 0fa11b5e9465a..7191fffc55f28 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1745,12 +1745,12 @@ "@elastic/transport" "^8.3.1" tslib "^2.4.0" -"@elastic/elasticsearch@^8.14.0": - version "8.14.0" - resolved "https://registry.yarnpkg.com/@elastic/elasticsearch/-/elasticsearch-8.14.0.tgz#93b1f2a7cb6cc5cd1ceebf5060576bc690432e0a" - integrity sha512-MGrgCI4y+Ozssf5Q2IkVJlqt5bUMnKIICG2qxeOfrJNrVugMCBCAQypyesmSSocAtNm8IX3LxfJ3jQlFHmKe2w== +"@elastic/elasticsearch@^8.15.0": + version "8.15.0" + resolved "https://registry.yarnpkg.com/@elastic/elasticsearch/-/elasticsearch-8.15.0.tgz#cb29b3ae33203c545d435cf3dc4b557c8b4961d5" + integrity sha512-mG90EMdTDoT6GFSdqpUAhWK9LGuiJo6tOWqs0Usd/t15mPQDj7ZqHXfCBqNkASZpwPZpbAYVjd57S6nbUBINCg== dependencies: - "@elastic/transport" "^8.6.0" + "@elastic/transport" "^8.7.0" tslib "^2.4.0" "@elastic/ems-client@8.5.3": @@ -1935,11 +1935,12 @@ undici "^5.21.2" yaml "^2.2.2" -"@elastic/transport@^8.3.1", "@elastic/transport@^8.6.0": - version "8.6.0" - resolved "https://registry.yarnpkg.com/@elastic/transport/-/transport-8.6.0.tgz#8de9794c87eb0fd2bdb2c6c1e32792aeb06b32bc" - integrity sha512-/Ucpztrc+urZK8yCtFBUu2LePYJNnukgZSUUApUzGH/SxejqkH526Nph7aru8I0vZwdW5wqgCHSOIq3J7tIxGg== +"@elastic/transport@^8.3.1", "@elastic/transport@^8.7.0": + version "8.7.0" + resolved "https://registry.yarnpkg.com/@elastic/transport/-/transport-8.7.0.tgz#006987fc5583f61c266e0b1003371e82efc7a6b5" + integrity sha512-IqXT7a8DZPJtqP2qmX1I2QKmxYyN27kvSW4g6pInESE1SuGwZDp2FxHJ6W2kwmYOJwQdAt+2aWwzXO5jHo9l4A== dependencies: + "@opentelemetry/api" "1.x" debug "^4.3.4" hpagent "^1.0.0" ms "^2.1.3" @@ -7943,10 +7944,10 @@ dependencies: "@opentelemetry/api" "^1.0.0" -"@opentelemetry/api@^1.0.0", "@opentelemetry/api@^1.1.0", "@opentelemetry/api@^1.4.1": - version "1.8.0" - resolved "https://registry.yarnpkg.com/@opentelemetry/api/-/api-1.8.0.tgz#5aa7abb48f23f693068ed2999ae627d2f7d902ec" - integrity sha512-I/s6F7yKUDdtMsoBWXJe8Qz40Tui5vsuKCWJEWVL+5q9sSWRzzx6v2KeNsOBEwd94j0eWkpWCH4yB6rZg9Mf0w== +"@opentelemetry/api@1.x", "@opentelemetry/api@^1.0.0", "@opentelemetry/api@^1.1.0", "@opentelemetry/api@^1.4.1": + version "1.9.0" + resolved "https://registry.yarnpkg.com/@opentelemetry/api/-/api-1.9.0.tgz#d03eba68273dc0f7509e2a3d5cba21eae10379fe" + integrity sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg== "@opentelemetry/core@1.15.0": version "1.15.0"