From 408c761f9c73db7cdadd1ca5dd7b15dccbbce344 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 14 Jan 2025 04:47:27 +1100 Subject: [PATCH] [8.x] [ES `body` removal] `@elastic/search-kibana` (#204876) (#206294) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Backport This will backport the following commits from `main` to `8.x`: - [[ES `body` removal] `@elastic/search-kibana` (#204876)](https://github.com/elastic/kibana/pull/204876) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Alejandro Fernández Haro --- .../src/components/api_key_flyout_wrapper.tsx | 2 +- .../pipelines/simulate_existing_ml_inference_pipeline.ts | 2 +- .../simulate_ml_inference_pipeline_processors.ts | 2 +- .../pipelines/ml_inference/test_pipeline_logic.ts | 2 +- .../enterprise_search/server/lib/indices/fetch_indices.ts | 2 +- .../ml_inference/get_ml_inference_pipeline_history.ts | 2 +- .../lib/indices/utils/extract_always_show_indices.test.ts | 2 +- .../lib/indices/utils/extract_always_show_indices.ts | 2 +- .../server/lib/ml/get_ml_model_deployment_status.ts | 2 +- .../server/lib/ml/start_ml_model_deployment.ts | 2 +- .../server/lib/ml/start_ml_model_download.ts | 8 +++----- .../public/components/quick_stats/mappings_convertor.ts | 5 +---- .../public/hooks/api/use_delete_document.ts | 2 +- .../search/plugins/search_indices/public/types.ts | 5 +---- .../plugins/search_indices/server/utils/index_utils.ts | 2 +- .../search_playground/public/hooks/use_query_indices.ts | 2 +- .../search/plugins/search_playground/public/types.ts | 2 +- .../search_playground/public/utils/create_query.ts | 2 +- .../server/lib/elasticsearch_retriever.ts | 2 +- .../serverless_search/server/lib/indices/fetch_indices.ts | 2 +- .../plugins/serverless_search/server/utils/index_utils.ts | 2 +- .../functional/test_suites/search/inference_management.ts | 2 +- 22 files changed, 24 insertions(+), 32 deletions(-) diff --git a/x-pack/solutions/search/packages/kbn-search-api-keys-components/src/components/api_key_flyout_wrapper.tsx b/x-pack/solutions/search/packages/kbn-search-api-keys-components/src/components/api_key_flyout_wrapper.tsx index bf69875a42647..809ae8441ee93 100644 --- a/x-pack/solutions/search/packages/kbn-search-api-keys-components/src/components/api_key_flyout_wrapper.tsx +++ b/x-pack/solutions/search/packages/kbn-search-api-keys-components/src/components/api_key_flyout_wrapper.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { ApiKeyFlyout, ApiKeyFlyoutProps } from '@kbn/security-api-key-management'; -import type { SecurityCreateApiKeyResponse } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { SecurityCreateApiKeyResponse } from '@elastic/elasticsearch/lib/api/types'; const API_KEY_NAME = 'Unrestricted API Key'; diff --git a/x-pack/solutions/search/plugins/enterprise_search/public/applications/enterprise_search_content/api/pipelines/simulate_existing_ml_inference_pipeline.ts b/x-pack/solutions/search/plugins/enterprise_search/public/applications/enterprise_search_content/api/pipelines/simulate_existing_ml_inference_pipeline.ts index b822017cc0726..df5c80b1139eb 100644 --- a/x-pack/solutions/search/plugins/enterprise_search/public/applications/enterprise_search_content/api/pipelines/simulate_existing_ml_inference_pipeline.ts +++ b/x-pack/solutions/search/plugins/enterprise_search/public/applications/enterprise_search_content/api/pipelines/simulate_existing_ml_inference_pipeline.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { IngestSimulateResponse } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { IngestSimulateResponse } from '@elastic/elasticsearch/lib/api/types'; import { createApiLogic } from '../../../shared/api_logic/create_api_logic'; diff --git a/x-pack/solutions/search/plugins/enterprise_search/public/applications/enterprise_search_content/api/pipelines/simulate_ml_inference_pipeline_processors.ts b/x-pack/solutions/search/plugins/enterprise_search/public/applications/enterprise_search_content/api/pipelines/simulate_ml_inference_pipeline_processors.ts index 18c90fbd7e6c1..7981b8b45e339 100644 --- a/x-pack/solutions/search/plugins/enterprise_search/public/applications/enterprise_search_content/api/pipelines/simulate_ml_inference_pipeline_processors.ts +++ b/x-pack/solutions/search/plugins/enterprise_search/public/applications/enterprise_search_content/api/pipelines/simulate_ml_inference_pipeline_processors.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { IngestSimulateResponse } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { IngestSimulateResponse } from '@elastic/elasticsearch/lib/api/types'; import type { MlInferencePipeline } from '../../../../../common/types/pipelines'; diff --git a/x-pack/solutions/search/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/test_pipeline_logic.ts b/x-pack/solutions/search/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/test_pipeline_logic.ts index deed56ab72986..be802834c86dd 100644 --- a/x-pack/solutions/search/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/test_pipeline_logic.ts +++ b/x-pack/solutions/search/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/test_pipeline_logic.ts @@ -7,7 +7,7 @@ import { kea, MakeLogicType } from 'kea'; -import { IngestSimulateResponse } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { IngestSimulateResponse } from '@elastic/elasticsearch/lib/api/types'; import { Status, HttpError } from '../../../../../../../common/types/api'; import { MlInferencePipeline } from '../../../../../../../common/types/pipelines'; diff --git a/x-pack/solutions/search/plugins/enterprise_search/server/lib/indices/fetch_indices.ts b/x-pack/solutions/search/plugins/enterprise_search/server/lib/indices/fetch_indices.ts index 94e65344f5a65..51ad2b61ee15e 100644 --- a/x-pack/solutions/search/plugins/enterprise_search/server/lib/indices/fetch_indices.ts +++ b/x-pack/solutions/search/plugins/enterprise_search/server/lib/indices/fetch_indices.ts @@ -10,7 +10,7 @@ import { IndicesGetResponse, SecurityHasPrivilegesPrivileges, IndicesStatsIndicesStats, -} from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +} from '@elastic/elasticsearch/lib/api/types'; import { IScopedClusterClient } from '@kbn/core/server'; import { AlwaysShowPattern, ElasticsearchIndexWithPrivileges } from '../../../common/types/indices'; diff --git a/x-pack/solutions/search/plugins/enterprise_search/server/lib/indices/pipelines/ml_inference/get_ml_inference_pipeline_history.ts b/x-pack/solutions/search/plugins/enterprise_search/server/lib/indices/pipelines/ml_inference/get_ml_inference_pipeline_history.ts index f6a01ec2b3e87..9201e3184c2a4 100644 --- a/x-pack/solutions/search/plugins/enterprise_search/server/lib/indices/pipelines/ml_inference/get_ml_inference_pipeline_history.ts +++ b/x-pack/solutions/search/plugins/enterprise_search/server/lib/indices/pipelines/ml_inference/get_ml_inference_pipeline_history.ts @@ -8,7 +8,7 @@ import { AggregationsMultiBucketAggregateBase, AggregationsStringRareTermsBucketKeys, -} from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +} from '@elastic/elasticsearch/lib/api/types'; import { ElasticsearchClient } from '@kbn/core/server'; diff --git a/x-pack/solutions/search/plugins/enterprise_search/server/lib/indices/utils/extract_always_show_indices.test.ts b/x-pack/solutions/search/plugins/enterprise_search/server/lib/indices/utils/extract_always_show_indices.test.ts index d67d4b4addc8b..40ffc1a04f713 100644 --- a/x-pack/solutions/search/plugins/enterprise_search/server/lib/indices/utils/extract_always_show_indices.test.ts +++ b/x-pack/solutions/search/plugins/enterprise_search/server/lib/indices/utils/extract_always_show_indices.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SecurityHasPrivilegesPrivileges } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { SecurityHasPrivilegesPrivileges } from '@elastic/elasticsearch/lib/api/types'; import { ElasticsearchIndex } from '@kbn/search-connectors'; import { expandAliases, getAlwaysShowAliases } from './extract_always_show_indices'; diff --git a/x-pack/solutions/search/plugins/enterprise_search/server/lib/indices/utils/extract_always_show_indices.ts b/x-pack/solutions/search/plugins/enterprise_search/server/lib/indices/utils/extract_always_show_indices.ts index 4312bcebd6f83..18cd54927908b 100644 --- a/x-pack/solutions/search/plugins/enterprise_search/server/lib/indices/utils/extract_always_show_indices.ts +++ b/x-pack/solutions/search/plugins/enterprise_search/server/lib/indices/utils/extract_always_show_indices.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SecurityHasPrivilegesPrivileges } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { SecurityHasPrivilegesPrivileges } from '@elastic/elasticsearch/lib/api/types'; import { ElasticsearchIndex } from '@kbn/search-connectors'; import { AlwaysShowPattern } from '../../../../common/types/indices'; diff --git a/x-pack/solutions/search/plugins/enterprise_search/server/lib/ml/get_ml_model_deployment_status.ts b/x-pack/solutions/search/plugins/enterprise_search/server/lib/ml/get_ml_model_deployment_status.ts index 2d65d516dd5bf..494cb925bf77f 100644 --- a/x-pack/solutions/search/plugins/enterprise_search/server/lib/ml/get_ml_model_deployment_status.ts +++ b/x-pack/solutions/search/plugins/enterprise_search/server/lib/ml/get_ml_model_deployment_status.ts @@ -8,7 +8,7 @@ import { MlGetTrainedModelsStatsRequest, MlGetTrainedModelsRequest, -} from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +} from '@elastic/elasticsearch/lib/api/types'; import { MlTrainedModels } from '@kbn/ml-plugin/server'; import { MlModelDeploymentStatus, MlModelDeploymentState } from '../../../common/types/ml'; diff --git a/x-pack/solutions/search/plugins/enterprise_search/server/lib/ml/start_ml_model_deployment.ts b/x-pack/solutions/search/plugins/enterprise_search/server/lib/ml/start_ml_model_deployment.ts index becd34a6c3c95..acf4a9d47edb0 100644 --- a/x-pack/solutions/search/plugins/enterprise_search/server/lib/ml/start_ml_model_deployment.ts +++ b/x-pack/solutions/search/plugins/enterprise_search/server/lib/ml/start_ml_model_deployment.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { MlStartTrainedModelDeploymentRequest } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { MlStartTrainedModelDeploymentRequest } from '@elastic/elasticsearch/lib/api/types'; import { MlTrainedModels } from '@kbn/ml-plugin/server'; diff --git a/x-pack/solutions/search/plugins/enterprise_search/server/lib/ml/start_ml_model_download.ts b/x-pack/solutions/search/plugins/enterprise_search/server/lib/ml/start_ml_model_download.ts index ffa51acc5bd32..7684baaeae161 100644 --- a/x-pack/solutions/search/plugins/enterprise_search/server/lib/ml/start_ml_model_download.ts +++ b/x-pack/solutions/search/plugins/enterprise_search/server/lib/ml/start_ml_model_download.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { MlPutTrainedModelRequest } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { MlPutTrainedModelRequest } from '@elastic/elasticsearch/lib/api/types'; import { MlTrainedModels } from '@kbn/ml-plugin/server'; import { MlModelDeploymentState, MlModelDeploymentStatus } from '../../../common/types/ml'; @@ -43,10 +43,8 @@ export const startMlModelDownload = async ( // we're not downloaded yet - let's initiate that... const putRequest: MlPutTrainedModelRequest = { - body: { - input: { - field_names: ['text_field'], - }, + input: { + field_names: ['text_field'], }, model_id: modelName, }; diff --git a/x-pack/solutions/search/plugins/search_indices/public/components/quick_stats/mappings_convertor.ts b/x-pack/solutions/search/plugins/search_indices/public/components/quick_stats/mappings_convertor.ts index 749fe05de1f54..b6063c7c3694c 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/components/quick_stats/mappings_convertor.ts +++ b/x-pack/solutions/search/plugins/search_indices/public/components/quick_stats/mappings_convertor.ts @@ -5,10 +5,7 @@ * 2.0. */ -import type { - MappingProperty, - MappingPropertyBase, -} from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { MappingProperty, MappingPropertyBase } from '@elastic/elasticsearch/lib/api/types'; import type { Mappings } from '../../types'; interface VectorFieldTypes { diff --git a/x-pack/solutions/search/plugins/search_indices/public/hooks/api/use_delete_document.ts b/x-pack/solutions/search/plugins/search_indices/public/hooks/api/use_delete_document.ts index 4c5a64b270f91..d2190d46b32b5 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/hooks/api/use_delete_document.ts +++ b/x-pack/solutions/search/plugins/search_indices/public/hooks/api/use_delete_document.ts @@ -7,7 +7,7 @@ import { AcknowledgedResponseBase } from '@elastic/elasticsearch/lib/api/types'; import { useMutation, useQueryClient } from '@tanstack/react-query'; -import { SearchHit } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { SearchHit } from '@elastic/elasticsearch/lib/api/types'; import { MutationKeys, QueryKeys } from '../../constants'; import { useKibana } from '../use_kibana'; import { INDEX_SEARCH_POLLING, IndexDocuments } from './use_document_search'; diff --git a/x-pack/solutions/search/plugins/search_indices/public/types.ts b/x-pack/solutions/search/plugins/search_indices/public/types.ts index ccf4d56e13a67..abf749b67e374 100644 --- a/x-pack/solutions/search/plugins/search_indices/public/types.ts +++ b/x-pack/solutions/search/plugins/search_indices/public/types.ts @@ -13,10 +13,7 @@ import type { UsageCollectionSetup, UsageCollectionStart, } from '@kbn/usage-collection-plugin/public'; -import type { - MappingProperty, - MappingPropertyBase, -} from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { MappingProperty, MappingPropertyBase } from '@elastic/elasticsearch/lib/api/types'; import type { IndexManagementPluginSetup, IndexManagementPluginStart, diff --git a/x-pack/solutions/search/plugins/search_indices/server/utils/index_utils.ts b/x-pack/solutions/search/plugins/search_indices/server/utils/index_utils.ts index d0b47b303679e..31ccb562f91bb 100644 --- a/x-pack/solutions/search/plugins/search_indices/server/utils/index_utils.ts +++ b/x-pack/solutions/search/plugins/search_indices/server/utils/index_utils.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { IndicesIndexState } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { IndicesIndexState } from '@elastic/elasticsearch/lib/api/types'; export function isHidden(index: IndicesIndexState): boolean { return index.settings?.index?.hidden === true || index.settings?.index?.hidden === 'true'; diff --git a/x-pack/solutions/search/plugins/search_playground/public/hooks/use_query_indices.ts b/x-pack/solutions/search/plugins/search_playground/public/hooks/use_query_indices.ts index d011b471a68d6..5ce52ecbdae27 100644 --- a/x-pack/solutions/search/plugins/search_playground/public/hooks/use_query_indices.ts +++ b/x-pack/solutions/search/plugins/search_playground/public/hooks/use_query_indices.ts @@ -6,7 +6,7 @@ */ import { useQuery } from '@tanstack/react-query'; -import { IndexName } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { IndexName } from '@elastic/elasticsearch/lib/api/types'; import { useKibana } from './use_kibana'; import { APIRoutes } from '../types'; diff --git a/x-pack/solutions/search/plugins/search_playground/public/types.ts b/x-pack/solutions/search/plugins/search_playground/public/types.ts index dfd415d5b9781..4ec69553e1c72 100644 --- a/x-pack/solutions/search/plugins/search_playground/public/types.ts +++ b/x-pack/solutions/search/plugins/search_playground/public/types.ts @@ -10,7 +10,7 @@ import { IndexName, IndicesStatsIndexMetadataState, Uuid, -} from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +} from '@elastic/elasticsearch/lib/api/types'; import type { NavigationPublicPluginStart } from '@kbn/navigation-plugin/public'; import React, { ComponentType } from 'react'; import type { SharePluginSetup, SharePluginStart } from '@kbn/share-plugin/public'; diff --git a/x-pack/solutions/search/plugins/search_playground/public/utils/create_query.ts b/x-pack/solutions/search/plugins/search_playground/public/utils/create_query.ts index 5dcb85eb4f50e..63cdcdf76bb65 100644 --- a/x-pack/solutions/search/plugins/search_playground/public/utils/create_query.ts +++ b/x-pack/solutions/search/plugins/search_playground/public/utils/create_query.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { RetrieverContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { RetrieverContainer } from '@elastic/elasticsearch/lib/api/types'; import { IndicesQuerySourceFields, QuerySourceFields } from '../types'; export type IndexFields = Record; diff --git a/x-pack/solutions/search/plugins/search_playground/server/lib/elasticsearch_retriever.ts b/x-pack/solutions/search/plugins/search_playground/server/lib/elasticsearch_retriever.ts index 8504651bb6398..57967ba773569 100644 --- a/x-pack/solutions/search/plugins/search_playground/server/lib/elasticsearch_retriever.ts +++ b/x-pack/solutions/search/plugins/search_playground/server/lib/elasticsearch_retriever.ts @@ -12,7 +12,7 @@ import { AggregationsAggregate, SearchHit, SearchResponse, -} from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +} from '@elastic/elasticsearch/lib/api/types'; import { getValueForSelectedField } from '../utils/get_value_for_selected_field'; export interface ElasticsearchRetrieverInput extends BaseRetrieverInput { diff --git a/x-pack/solutions/search/plugins/serverless_search/server/lib/indices/fetch_indices.ts b/x-pack/solutions/search/plugins/serverless_search/server/lib/indices/fetch_indices.ts index 9560bbe7f9bb3..6027fb438af6b 100644 --- a/x-pack/solutions/search/plugins/serverless_search/server/lib/indices/fetch_indices.ts +++ b/x-pack/solutions/search/plugins/serverless_search/server/lib/indices/fetch_indices.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { IndicesStatsIndicesStats } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { IndicesStatsIndicesStats } from '@elastic/elasticsearch/lib/api/types'; import { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; import { isNotNullish } from '../../../common/utils/is_not_nullish'; import { isHidden, isClosed } from '../../utils/index_utils'; diff --git a/x-pack/solutions/search/plugins/serverless_search/server/utils/index_utils.ts b/x-pack/solutions/search/plugins/serverless_search/server/utils/index_utils.ts index 043bb80d7f8d0..5f86f9ae9d962 100644 --- a/x-pack/solutions/search/plugins/serverless_search/server/utils/index_utils.ts +++ b/x-pack/solutions/search/plugins/serverless_search/server/utils/index_utils.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { IndicesIndexState } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { IndicesIndexState } from '@elastic/elasticsearch/lib/api/types'; export function isHidden(index: IndicesIndexState): boolean { return index.settings?.index?.hidden === true || index.settings?.index?.hidden === 'true'; diff --git a/x-pack/test_serverless/functional/test_suites/search/inference_management.ts b/x-pack/test_serverless/functional/test_suites/search/inference_management.ts index a292fc24e9550..d0e317fd2db32 100644 --- a/x-pack/test_serverless/functional/test_suites/search/inference_management.ts +++ b/x-pack/test_serverless/functional/test_suites/search/inference_management.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type * as estypes from '@elastic/elasticsearch/lib/api/types'; import { testHasEmbeddedConsole } from './embedded_console';