Skip to content

Commit a452d8e

Browse files
committed
Continue to iterate on test failures
1 parent 279d4c2 commit a452d8e

File tree

2 files changed

+148
-161
lines changed

2 files changed

+148
-161
lines changed

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

Lines changed: 70 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ setup:
190190

191191
- match: { "test-index.mappings.properties.dense_field.type": semantic_text }
192192
- match: { "test-index.mappings.properties.dense_field.inference_id": dense-inference-id }
193-
- length: { "test-index.mappings.properties.dense_field": 2 }
193+
- not_exists: test-index.mappings.properties.dense_field.model_settings
194194

195195
- do:
196196
index:
@@ -223,7 +223,58 @@ setup:
223223
- match: { "test-index.mappings.properties.dense_field.type": semantic_text }
224224
- match: { "test-index.mappings.properties.dense_field.inference_id": dense-inference-id }
225225
- match: { "test-index.mappings.properties.dense_field.model_settings.task_type": text_embedding }
226-
- length: { "test-index.mappings.properties.dense_field": 3 }
226+
- exists: test-index.mappings.properties.dense_field.model_settings
227+
228+
---
229+
"Indexes dense vector document with index_options":
230+
- requires:
231+
cluster_features: "semantic_text.index_options"
232+
reason: index_options introduced in 8.19.0
233+
# Checks vector mapping is not updated until first doc arrives
234+
- do:
235+
indices.get_mapping:
236+
index: test-index
237+
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
245+
246+
- do:
247+
index:
248+
index: test-index
249+
id: doc_2
250+
body:
251+
dense_field: "these are not the droids you're looking for. He's free to go around"
252+
_inference_fields.dense_field:
253+
inference:
254+
inference_id: dense-inference-id
255+
model_settings:
256+
task_type: text_embedding
257+
dimensions: 4
258+
similarity: cosine
259+
element_type: float
260+
chunks:
261+
dense_field:
262+
- start_offset: 0
263+
end_offset: 44
264+
embeddings: [ 0.04673296958208084, -0.03237321600317955, -0.02543032355606556, 0.056035321205854416 ]
265+
- start_offset: 44
266+
end_offset: 67
267+
embeddings: [ 0.00641461368650198, -0.0016253676731139421, -0.05126338079571724, 0.053438711911439896 ]
268+
269+
# Checks mapping is updated when first doc arrives
270+
- do:
271+
indices.get_mapping:
272+
index: test-index
273+
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
227278

228279
---
229280
"Field caps with text embedding":
@@ -416,7 +467,7 @@ setup:
416467
index_options:
417468
dense_vector:
418469
type: int8_hnsw
419-
m: 16
470+
m: 20
420471
ef_construction: 100
421472
confidence_interval: 1.0
422473

@@ -425,7 +476,7 @@ setup:
425476
index: test-index-options
426477

427478
- 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 }
479+
- match: { "test-index-options.mappings.properties.semantic_field.index_options.dense_vector.m": 20 }
429480
- match: { "test-index-options.mappings.properties.semantic_field.index_options.dense_vector.ef_construction": 100 }
430481
- match: { "test-index-options.mappings.properties.semantic_field.index_options.dense_vector.confidence_interval": 1.0 }
431482

@@ -446,7 +497,7 @@ setup:
446497
index_options:
447498
dense_vector:
448499
type: int8_hnsw
449-
m: 16
500+
m: 20
450501
ef_construction: 100
451502
confidence_interval: 1.0
452503
chunks:
@@ -462,77 +513,16 @@ setup:
462513
indices.get_mapping:
463514
index: test-index-options
464515

465-
- match: { test-index-options.mappings.properties.semantic_field: "foo" }
466-
467-
468-
---
469-
"Users can set partial dense vector index options and use dense vector defaults for nonspecified options":
470-
- requires:
471-
cluster_features: "semantic_text.index_options"
472-
reason: Index options introduced in 8.18.0
473-
474-
- do:
475-
indices.create:
476-
index: test-index-options
477-
body:
478-
settings:
479-
index:
480-
mapping:
481-
semantic_text:
482-
use_legacy_format: false
483-
mappings:
484-
properties:
485-
semantic_field:
486-
type: semantic_text
487-
inference_id: dense-inference-id
488-
index_options:
489-
dense_vector:
490-
type: int8_hnsw
491-
492-
- do:
493-
indices.get_mapping:
494-
index: test-index-options
495-
496-
- match: { "test-index-options.mappings.properties.semantic_field.dense_vector.index_options.type": "int8_hnsw" }
497-
- match: { "test-index-options.mappings.properties.semantic_field.index_options.dense_vector.m": 16 }
516+
- match: { "test-index-options.mappings.properties.semantic_field.index_options.dense_vector.type": int8_hnsw }
517+
- match: { "test-index-options.mappings.properties.semantic_field.index_options.dense_vector.m": 20 }
498518
- match: { "test-index-options.mappings.properties.semantic_field.index_options.dense_vector.ef_construction": 100 }
499-
500-
- do:
501-
index:
502-
index: test-index-options
503-
id: doc_1
504-
body:
505-
semantic_field: "these are not the droids you're looking for. He's free to go around"
506-
_inference_fields.semantic_field:
507-
inference:
508-
inference_id: dense-inference-id
509-
model_settings:
510-
task_type: text_embedding
511-
dimensions: 4
512-
similarity: cosine
513-
element_type: float
514-
chunks:
515-
semantic_field:
516-
- start_offset: 0
517-
end_offset: 44
518-
embeddings: [ 0.04673296958208084, -0.03237321600317955, -0.02543032355606556, 0.056035321205854416 ]
519-
- start_offset: 44
520-
end_offset: 67
521-
embeddings: [ 0.00641461368650198, -0.0016253676731139421, -0.05126338079571724, 0.053438711911439896 ]
522-
523-
- do:
524-
get:
525-
index: test-index-options
526-
id: doc_1
527-
528-
- match: { _source.semantic_field: "these are not the droids you're looking for. He's free to go around" }
529-
519+
- match: { "test-index-options.mappings.properties.semantic_field.index_options.dense_vector.confidence_interval": 1.0 }
530520

531521
---
532-
"Not specifying index options does not return index options":
522+
"Not specifying index options results in default index options":
533523
- requires:
534524
cluster_features: "semantic_text.index_options"
535-
reason: Index options introduced in 8.18.0
525+
reason: Index options introduced in 8.19.0
536526

537527
- do:
538528
indices.create:
@@ -553,14 +543,18 @@ setup:
553543
indices.get_mapping:
554544
index: test-index-options
555545

556-
- not_exists: test-index-options.mappings.properties.semantic_field.index_options
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 }
550+
557551

558552

559553
---
560554
"Specifying incompatible dense vector index options will fail":
561555
- requires:
562556
cluster_features: "semantic_text.index_options"
563-
reason: Index options introduced in 8.18.0
557+
reason: Index options introduced in 8.19.0
564558

565559
- do:
566560
catch: /unsupported parameters/
@@ -586,7 +580,7 @@ setup:
586580
"Specifying unsupported index option types will fail":
587581
- requires:
588582
cluster_features: "semantic_text.index_options"
589-
reason: Index options introduced in 8.18.0
583+
reason: Index options introduced in 8.19.0
590584

591585
- do:
592586
catch: /Unsupported index options type/
@@ -628,7 +622,7 @@ setup:
628622
"Index option type is required":
629623
- requires:
630624
cluster_features: "semantic_text.index_options"
631-
reason: Index options introduced in 8.18.0
625+
reason: Index options introduced in 8.19.0
632626

633627
- do:
634628
catch: /Required type/
@@ -653,7 +647,7 @@ setup:
653647
"Model is required for index options":
654648
- requires:
655649
cluster_features: "semantic_text.index_options"
656-
reason: Index options introduced in 8.18.0
650+
reason: Index options introduced in 8.19.0
657651

658652
- do:
659653
catch: /Model settings must be set to validate index options/

0 commit comments

Comments
 (0)