Skip to content

Commit 58841e6

Browse files
maxhniebergallelasticmachine
authored andcommitted
only return deprecation warning for elser service (elastic#114507)
Co-authored-by: Elastic Machine <[email protected]>
1 parent d690e97 commit 58841e6

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/elasticsearch/ElasticsearchInternalService.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ public void parseRequestConfig(
152152
config,
153153
preferredModelVariant,
154154
serviceSettingsMap,
155+
true,
155156
chunkingSettings,
156157
modelListener
157158
)
@@ -183,6 +184,7 @@ public void parseRequestConfig(
183184
config,
184185
preferredModelVariant,
185186
serviceSettingsMap,
187+
OLD_ELSER_SERVICE_NAME.equals(serviceName),
186188
chunkingSettings,
187189
modelListener
188190
)
@@ -342,6 +344,7 @@ private void elserCase(
342344
Map<String, Object> config,
343345
PreferredModelVariant preferredModelVariant,
344346
Map<String, Object> serviceSettingsMap,
347+
boolean isElserService,
345348
ChunkingSettings chunkingSettings,
346349
ActionListener<Model> modelListener
347350
) {
@@ -372,15 +375,17 @@ private void elserCase(
372375
}
373376
}
374377

375-
DEPRECATION_LOGGER.warn(
376-
DeprecationCategory.API,
377-
"inference_api_elser_service",
378-
"The [{}] service is deprecated and will be removed in a future release. Use the [{}] service instead, with"
379-
+ " [model_id] set to [{}] in the [service_settings]",
380-
OLD_ELSER_SERVICE_NAME,
381-
ElasticsearchInternalService.NAME,
382-
defaultModelId
383-
);
378+
if (isElserService) {
379+
DEPRECATION_LOGGER.warn(
380+
DeprecationCategory.API,
381+
"inference_api_elser_service",
382+
"The [{}] service is deprecated and will be removed in a future release. Use the [{}] service instead, with"
383+
+ " [model_id] set to [{}] in the [service_settings]",
384+
OLD_ELSER_SERVICE_NAME,
385+
ElasticsearchInternalService.NAME,
386+
defaultModelId
387+
);
388+
}
384389

385390
if (modelVariantDoesNotMatchArchitecturesAndIsNotPlatformAgnostic(preferredModelVariant, esServiceSettingsBuilder.getModelId())) {
386391
throw new IllegalArgumentException(

0 commit comments

Comments
 (0)