Skip to content

Commit 1214fdf

Browse files
committed
A little closer, but doesn't propagate defaults
1 parent 84bf8db commit 1214fdf

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,12 @@ public Builder(
250250
this.indexOptions = new Parameter<>(
251251
INDEX_OPTIONS_FIELD,
252252
true,
253-
() -> defaultIndexOptions(indexVersionCreated, modelRegistry.getMinimalServiceSettings(inferenceId.get())),
253+
() -> null,
254254
(n, c, o) -> parseIndexOptionsFromMap(n, o, c.indexVersionCreated()),
255255
mapper -> ((SemanticTextFieldType) mapper.fieldType()).indexOptions,
256256
XContentBuilder::field,
257257
Objects::toString
258-
).acceptsNull(); // .setSerializerCheck(this::indexOptionsSerializerCheck);
258+
).acceptsNull().setSerializerCheck(this::indexOptionsSerializerCheck);
259259

260260
this.inferenceFieldBuilder = c -> {
261261
// Resolve the model setting from the registry if it has not been set yet.
@@ -272,9 +272,9 @@ public Builder(
272272
};
273273
}
274274

275-
// private boolean indexOptionsSerializerCheck(boolean includeDefaults, boolean isConfigured, SemanticTextIndexOptions value) {
276-
// return includeDefaults || Objects.equals(value, defaultIndexOptions(indexVersionCreated, modelSettings.get())) == false;
277-
// }
275+
private boolean indexOptionsSerializerCheck(boolean includeDefaults, boolean isConfigured, SemanticTextIndexOptions value) {
276+
return includeDefaults || value == null && defaultIndexOptions(indexVersionCreated, modelSettings.get()) != null;
277+
}
278278

279279
public Builder setInferenceId(String id) {
280280
this.inferenceId.setValue(id);

0 commit comments

Comments
 (0)