Skip to content

Commit 4b11083

Browse files
committed
Add validation
1 parent 7b4d424 commit 4b11083

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ public SemanticTextFieldMapper build(MapperBuilderContext context) {
333333
);
334334
}
335335
if (indexOptions.get() != null) {
336-
validateIndexOptions(indexOptions.get(), inferenceId.getValue(), modelSettings.get());
336+
validateIndexOptions(indexOptions.get(), inferenceId.getValue(), resolvedModelSettings);
337337
}
338338
final String fullName = context.buildFullName(leafName());
339339

@@ -392,8 +392,11 @@ private void validateIndexOptions(SemanticTextIndexOptions indexOptions, String
392392
if (indexOptions == null) {
393393
return;
394394
}
395+
395396
if (modelSettings == null) {
396-
modelSettings = modelRegistry.getMinimalServiceSettings(inferenceId);
397+
throw new IllegalArgumentException(
398+
"Model settings must be set to validate index options for inference ID [" + inferenceId + "]"
399+
);
397400
}
398401

399402
// Right now text_embedding is the only task_type supporting index_options

0 commit comments

Comments
 (0)