From b189fe715912ad83a37e6bb77e2084dbdc41604b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Fern=C3=A1ndez=20Haro?= Date: Thu, 19 Dec 2024 12:06:42 +0100 Subject: [PATCH] [ES `body` removal] `@elastic/appex-qa` (#204878) ## Summary Attempt to remove the deprecated `body` in the ES client. --- .../src/lib/indices/create_index_stream.ts | 2 +- .../src/es_client.ts | 36 +++++++++---------- .../services/alerting_api.ts | 5 +-- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/packages/kbn-es-archiver/src/lib/indices/create_index_stream.ts b/packages/kbn-es-archiver/src/lib/indices/create_index_stream.ts index bb59ca9c5e9d4..c41ff3a399797 100644 --- a/packages/kbn-es-archiver/src/lib/indices/create_index_stream.ts +++ b/packages/kbn-es-archiver/src/lib/indices/create_index_stream.ts @@ -10,7 +10,7 @@ import { Transform, Readable } from 'stream'; import { inspect } from 'util'; -import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import * as estypes from '@elastic/elasticsearch/lib/api/types'; import type { Client } from '@elastic/elasticsearch'; import { ToolingLog } from '@kbn/tooling-log'; diff --git a/packages/kbn-performance-testing-dataset-extractor/src/es_client.ts b/packages/kbn-performance-testing-dataset-extractor/src/es_client.ts index 7c38789fe3dd9..97d0c390d8aee 100644 --- a/packages/kbn-performance-testing-dataset-extractor/src/es_client.ts +++ b/packages/kbn-performance-testing-dataset-extractor/src/es_client.ts @@ -9,7 +9,7 @@ import { Client } from '@elastic/elasticsearch'; import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types'; -import { SearchRequest, MsearchRequestItem } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { SearchRequest, MsearchRequestItem } from '@elastic/elasticsearch/lib/api/types'; import { ToolingLog } from '@kbn/tooling-log'; interface ClientOptions { @@ -116,26 +116,24 @@ export class ESClient { async getTransactions(queryFilters: QueryDslQueryContainer[]) { const searchRequest: SearchRequest = { index: this.tracesIndex, - body: { - sort: [ - { - '@timestamp': { - order: 'asc', - unmapped_type: 'boolean', - }, + sort: [ + { + '@timestamp': { + order: 'asc', + unmapped_type: 'boolean', }, - ], - size: 10000, - query: { - bool: { - filter: [ - { - bool: { - filter: queryFilters, - }, + }, + ], + size: 10000, + query: { + bool: { + filter: [ + { + bool: { + filter: queryFilters, }, - ], - }, + }, + ], }, }, }; diff --git a/x-pack/test/api_integration/deployment_agnostic/services/alerting_api.ts b/x-pack/test/api_integration/deployment_agnostic/services/alerting_api.ts index 855d5bd3cdff8..7a5cff10d58b1 100644 --- a/x-pack/test/api_integration/deployment_agnostic/services/alerting_api.ts +++ b/x-pack/test/api_integration/deployment_agnostic/services/alerting_api.ts @@ -5,10 +5,7 @@ * 2.0. */ -import type { - AggregationsAggregate, - SearchResponse, -} from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { AggregationsAggregate, SearchResponse } from '@elastic/elasticsearch/lib/api/types'; import { MetricThresholdParams } from '@kbn/infra-plugin/common/alerting/metrics'; import { ThresholdParams } from '@kbn/observability-plugin/common/custom_threshold_rule/types'; import { ApmRuleParamsType } from '@kbn/apm-plugin/common/rules/schema';