Skip to content

Commit 3e1c941

Browse files
committed
Fix some tests
1 parent 9a0ca94 commit 3e1c941

File tree

3 files changed

+41
-30
lines changed

3 files changed

+41
-30
lines changed

server/src/main/java/org/elasticsearch/cluster/metadata/InferenceFieldMetadata.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,6 @@ public static InferenceFieldMetadata fromXContent(XContentParser parser) throws
193193
}
194194
} else if (CHUNKING_SETTINGS_FIELD.equals(currentFieldName)) {
195195
chunkingSettings = parser.map();
196-
} else if (token.isValue()) {
197-
// Ignore other fields
198196
} else {
199197
parser.skipChildren();
200198
}

x-pack/plugin/inference/src/yamlRestTest/resources/rest-api-spec/test/inference/10_semantic_text_field_mapping.yml

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -230,22 +230,38 @@ setup:
230230
- requires:
231231
cluster_features: "semantic_text.index_options"
232232
reason: index_options introduced in 8.19.0
233+
234+
- do:
235+
indices.create:
236+
index: test-index-options
237+
body:
238+
settings:
239+
index:
240+
mapping:
241+
semantic_text:
242+
use_legacy_format: false
243+
mappings:
244+
properties:
245+
dense_field:
246+
type: semantic_text
247+
inference_id: dense-inference-id
248+
233249
# Checks vector mapping is not updated until first doc arrives
234250
- do:
235251
indices.get_mapping:
236-
index: test-index
252+
index: test-index-options
237253

238-
- match: { "test-index.mappings.properties.dense_field.type": semantic_text }
239-
- match: { "test-index.mappings.properties.dense_field.inference_id": dense-inference-id }
240-
- match: { "test-index.mappings.properties.dense_field.index_options.dense_vector.type": bbq_hnsw }
241-
- match: { "test-index.mappings.properties.dense_field.index_options.dense_vector.m": 16 }
242-
- match: { "test-index.mappings.properties.dense_field.index_options.dense_vector.ef_construction": 100 }
243-
- match: { "test-index.mappings.properties.dense_field.index_options.dense_vector.rescore_vector.oversample": 3 }
244-
- not_exists: test-index.mappings.properties.dense_field.model_settings
254+
- match: { "test-index-options.mappings.properties.dense_field.type": semantic_text }
255+
- match: { "test-index-options.mappings.properties.dense_field.inference_id": dense-inference-id }
256+
- match: { "test-index-options.mappings.properties.dense_field.index_options.dense_vector.type": bbq_hnsw }
257+
- match: { "test-index-options.mappings.properties.dense_field.index_options.dense_vector.m": 16 }
258+
- match: { "test-index-options.mappings.properties.dense_field.index_options.dense_vector.ef_construction": 100 }
259+
- match: { "test-index-options.mappings.properties.dense_field.index_options.dense_vector.rescore_vector.oversample": 3 }
260+
- not_exists: test-index-options.mappings.properties.dense_field.model_settings
245261

246262
- do:
247263
index:
248-
index: test-index
264+
index: test-index-options
249265
id: doc_2
250266
body:
251267
dense_field: "these are not the droids you're looking for. He's free to go around"
@@ -269,12 +285,12 @@ setup:
269285
# Checks mapping is updated when first doc arrives
270286
- do:
271287
indices.get_mapping:
272-
index: test-index
288+
index: test-index-options
273289

274-
- match: { "test-index.mappings.properties.dense_field.type": semantic_text }
275-
- match: { "test-index.mappings.properties.dense_field.inference_id": dense-inference-id }
276-
- match: { "test-index.mappings.properties.dense_field.model_settings.task_type": text_embedding }
277-
- exists: test-index.mappings.properties.dense_field.model_settings
290+
- match: { "test-index-options.mappings.properties.dense_field.type": semantic_text }
291+
- match: { "test-index-options.mappings.properties.dense_field.inference_id": dense-inference-id }
292+
- match: { "test-index-options.mappings.properties.dense_field.model_settings.task_type": text_embedding }
293+
- exists: test-index-options.mappings.properties.dense_field.model_settings
278294

279295
---
280296
"Field caps with text embedding":
@@ -494,12 +510,6 @@ setup:
494510
dimensions: 4
495511
similarity: cosine
496512
element_type: float
497-
index_options:
498-
dense_vector:
499-
type: int8_hnsw
500-
m: 20
501-
ef_construction: 100
502-
confidence_interval: 1.0
503513
chunks:
504514
semantic_field:
505515
- start_offset: 0
@@ -543,10 +553,10 @@ setup:
543553
indices.get_mapping:
544554
index: test-index-options
545555

546-
- match: { "semantic_field.mappings.properties.dense_field.index_options.dense_vector.type": bbq_hnsw }
547-
- match: { "semantic_field.mappings.properties.dense_field.index_options.dense_vector.m": 16 }
548-
- match: { "semantic_field.mappings.properties.dense_field.index_options.dense_vector.ef_construction": 100 }
549-
- match: { "semantic_field.mappings.properties.dense_field.index_options.dense_vector.rescore_vector.oversample": 3 }
556+
- match: { "test-index-options.mappings.properties.semantic_field.index_options.dense_vector.type": bbq_hnsw }
557+
- match: { "test-index-options.mappings.properties.semantic_field.index_options.dense_vector.m": 16 }
558+
- match: { "test-index-options.mappings.properties.semantic_field.index_options.dense_vector.ef_construction": 100 }
559+
- match: { "test-index-options.mappings.properties.semantic_field.index_options.dense_vector.rescore_vector.oversample": 3 }
550560

551561

552562

x-pack/plugin/inference/src/yamlRestTest/resources/rest-api-spec/test/inference/10_semantic_text_field_mapping_bwc.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ setup:
416416
index_options:
417417
dense_vector:
418418
type: int8_hnsw
419-
m: 16
419+
m: 20
420420
ef_construction: 100
421421
confidence_interval: 1.0
422422

@@ -425,7 +425,7 @@ setup:
425425
index: test-index-options
426426

427427
- match: { "test-index-options.mappings.properties.semantic_field.index_options.dense_vector.type": "int8_hnsw" }
428-
- match: { "test-index-options.mappings.properties.semantic_field.index_options.dense_vector.m": 16 }
428+
- match: { "test-index-options.mappings.properties.semantic_field.index_options.dense_vector.m": 20 }
429429
- match: { "test-index-options.mappings.properties.semantic_field.index_options.dense_vector.ef_construction": 100 }
430430
- match: { "test-index-options.mappings.properties.semantic_field.index_options.dense_vector.confidence_interval": 1.0 }
431431

@@ -446,7 +446,7 @@ setup:
446446
index_options:
447447
dense_vector:
448448
type: int8_hnsw
449-
m: 16
449+
m: 20
450450
ef_construction: 100
451451
confidence_interval: 1.0
452452
chunks:
@@ -462,7 +462,10 @@ setup:
462462
indices.get_mapping:
463463
index: test-index-options
464464

465-
- match: { test-index-options.mappings.properties.semantic_field: "foo" }
465+
- match: { "test-index-options.mappings.properties.semantic_field.index_options.dense_vector.type": "int8_hnsw" }
466+
- match: { "test-index-options.mappings.properties.semantic_field.index_options.dense_vector.m": 20 }
467+
- match: { "test-index-options.mappings.properties.semantic_field.index_options.dense_vector.ef_construction": 100 }
468+
- match: { "test-index-options.mappings.properties.semantic_field.index_options.dense_vector.confidence_interval": 1.0 }
466469

467470
---
468471
"Not specifying index options returns default index options":

0 commit comments

Comments
 (0)