[Search] Fix index error incorrectly showing up (#189283)

## Summary

This fixes a bug where the index error would show up for third-party
models because the logic for determining local models was incorrect.
This commit is contained in:
Sander Philipse 2024-07-26 16:34:35 +02:00 committed by GitHub
parent 27bddf284f
commit 98a7da9a83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -66,7 +66,7 @@ function hasProperties(field: MappingProperty): field is MappingPropertyBase {
}
function isLocalModel(model: InferenceServiceSettings): model is LocalInferenceServiceSettings {
return Boolean((model as LocalInferenceServiceSettings).service_settings.model_id);
return ['elser', 'elasticsearch'].includes((model as LocalInferenceServiceSettings).service);
}
export const IndexError: React.FC<IndexErrorProps> = ({ indexName }) => {
@ -124,7 +124,7 @@ export const IndexError: React.FC<IndexErrorProps> = ({ indexName }) => {
if (!modelStats || modelStats.deployment_stats?.state !== 'started') {
return {
error: i18n.translate(
'xpack.enterpriseSearch.indexOverview.indexErrors.missingModelError',
'xpack.enterpriseSearch.indexOverview.indexErrors.modelNotDeployedError',
{
defaultMessage:
'Model {modelId} for inference endpoint {inferenceId} in field {fieldName} has not been started',