Skip to content

Commit 272c731

Browse files
authored
[semantic_text] Warn on inference endpoint not created (elastic#127574)
This change fixes when we warn users that create a semantic_text field that points to a non-existing inference endpoint. The logging should happen only when the inference endpoint is checked against the registry and cases that don't use the registry should ignore it (recovery).
1 parent e75e45b commit 272c731

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/mapper/SemanticTextFieldMapper.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -302,21 +302,20 @@ public SemanticTextFieldMapper build(MapperBuilderContext context) {
302302
* This will delay the creation of sub-fields, so indexing and querying for this field won't work
303303
* until the corresponding inference endpoint is created.
304304
*/
305+
logger.warn(
306+
"The field [{}] references an unknown inference ID [{}]. "
307+
+ "Indexing and querying this field will not work correctly until the corresponding "
308+
+ "inference endpoint is created.",
309+
leafName(),
310+
inferenceId.get()
311+
);
305312
}
306313
} else {
307314
resolvedModelSettings = modelSettings.get();
308315
}
309316

310317
if (modelSettings.get() != null) {
311318
validateServiceSettings(modelSettings.get(), resolvedModelSettings);
312-
} else {
313-
logger.warn(
314-
"The field [{}] references an unknown inference ID [{}]. "
315-
+ "Indexing and querying this field will not work correctly until the corresponding "
316-
+ "inference endpoint is created.",
317-
leafName(),
318-
inferenceId.get()
319-
);
320319
}
321320

322321
final String fullName = context.buildFullName(leafName());

0 commit comments

Comments
 (0)