Skip to content

Commit 5babddf

Browse files
prwhelanmaxhniebergallelasticmachine
authored
only return deprecation warning for elser service (#114507) (#114770)
Co-authored-by: Max Hniebergall <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
1 parent c2cec39 commit 5babddf

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
@@ -150,6 +150,7 @@ public void parseRequestConfig(
150150
config,
151151
preferredModelVariant,
152152
serviceSettingsMap,
153+
true,
153154
chunkingSettings,
154155
modelListener
155156
)
@@ -181,6 +182,7 @@ public void parseRequestConfig(
181182
config,
182183
preferredModelVariant,
183184
serviceSettingsMap,
185+
OLD_ELSER_SERVICE_NAME.equals(serviceName),
184186
chunkingSettings,
185187
modelListener
186188
)
@@ -340,6 +342,7 @@ private void elserCase(
340342
Map<String, Object> config,
341343
PreferredModelVariant preferredModelVariant,
342344
Map<String, Object> serviceSettingsMap,
345+
boolean isElserService,
343346
ChunkingSettings chunkingSettings,
344347
ActionListener<Model> modelListener
345348
) {
@@ -370,15 +373,17 @@ private void elserCase(
370373
}
371374
}
372375

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

383388
throwIfNotEmptyMap(config, name());
384389
throwIfNotEmptyMap(serviceSettingsMap, name());

0 commit comments

Comments
 (0)