From 8f39bdfe252f3f334f1f27369223093a225e5fea Mon Sep 17 00:00:00 2001 From: Sander Philipse <94373878+sphilipse@users.noreply.github.com> Date: Wed, 21 Aug 2024 18:00:11 +0200 Subject: [PATCH] [Search] Change model id to inference id in index error message (#190787) ## Summary Changing 'model_id' to 'inference_id' to align with the new API spec. See also: https://github.com/elastic/kibana/pull/190729 --- .../components/search_index/index_error.tsx | 4 ++-- .../services/ml_api_service/inference_models.ts | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) 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 6b98cc1491864..38d50c9a731fd 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 @@ -100,14 +100,14 @@ export const IndexError: React.FC = ({ indexName }) => { const semanticTextFieldsWithErrors = semanticTextFields .map((field) => { const model = endpoints.endpoints.find( - (endpoint) => endpoint.model_id === field.source.inference_id + (endpoint) => endpoint.inference_id === field.source.inference_id ); if (!model) { return { error: i18n.translate( 'xpack.enterpriseSearch.indexOverview.indexErrors.missingModelError', { - defaultMessage: 'Model not found for inference endpoint {inferenceId}', + defaultMessage: 'Inference endpoint {inferenceId} not found', values: { inferenceId: field.source.inference_id as string, }, 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 736f4f275bb36..e60bc99d84bd2 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 @@ -10,6 +10,12 @@ import type { InferenceTaskType } from '@elastic/elasticsearch/lib/api/typesWith 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 { /** @@ -36,7 +42,7 @@ export function inferenceModelsApiProvider(httpService: HttpService) { */ async getAllInferenceEndpoints() { const result = await httpService.http<{ - endpoints: estypes.InferenceModelConfigContainer[]; + endpoints: GetInferenceEndpointsResponse[]; }>({ path: `${ML_INTERNAL_BASE_PATH}/_inference/all`, method: 'GET',