Skip to content

Commit e2270e0

Browse files
authored
[semantic_text] Warn on inference endpoint not created (elastic#127574) (elastic#127600)
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 a5a3ef2 commit e2270e0

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
@@ -303,21 +303,20 @@ public SemanticTextFieldMapper build(MapperBuilderContext context) {
303303
* This will delay the creation of sub-fields, so indexing and querying for this field won't work
304304
* until the corresponding inference endpoint is created.
305305
*/
306+
logger.warn(
307+
"The field [{}] references an unknown inference ID [{}]. "
308+
+ "Indexing and querying this field will not work correctly until the corresponding "
309+
+ "inference endpoint is created.",
310+
leafName(),
311+
inferenceId.get()
312+
);
306313
}
307314
} else {
308315
resolvedModelSettings = modelSettings.get();
309316
}
310317

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

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

0 commit comments

Comments
 (0)