Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semantic Text - Add YAML tests for inference metadata fields format #118841

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ca5fdb3
Update semantic text field mapping YAML tests to add inference metada…
Mikep86 Nov 27, 2024
03f9185
Update semantic text field mapping incompatible field mapping YAML te…
Mikep86 Nov 27, 2024
8eb4816
Fix tests in 10_semantic_text_field_mapping
Mikep86 Dec 12, 2024
ee7403e
Fix tests in 20_semantic_text_field_mapping_incompatible_field_mappin…
Mikep86 Dec 12, 2024
7738727
Update semantic text inference YAML tests to add inference metadata f…
Mikep86 Dec 13, 2024
26c2a26
Check that embeddings exist and offsets are as expected
Mikep86 Dec 13, 2024
718814f
Update semantic text query YAML tests to be applicable to both semant…
Mikep86 Dec 13, 2024
d12c9d9
Updating semantic text inference update YAML tests to add inference m…
Mikep86 Dec 13, 2024
7213b10
Merge branch 'inference_metadata_fields' into inference_metadata_fiel…
Mikep86 Dec 16, 2024
e52dbf1
Updated semantic text inference update YAML tests to add inference me…
Mikep86 Dec 16, 2024
22aaedc
Merge branch 'inference_metadata_fields' into inference_metadata_fiel…
Mikep86 Dec 16, 2024
75b6e48
Merge branch 'inference_metadata_fields' into inference_metadata_fiel…
Mikep86 Dec 17, 2024
848a88b
Merge branch 'inference_metadata_fields' into inference_metadata_fiel…
Mikep86 Dec 17, 2024
0c26211
Merge branch 'inference_metadata_fields' into inference_metadata_fiel…
Mikep86 Dec 18, 2024
7e65772
Fix flaky YAML test
Mikep86 Dec 18, 2024
6503dd6
Refactor semantic text field mapping YAML tests
Mikep86 Dec 18, 2024
37502b1
Refactor semantic text field mapping incompatible field mapping YAML …
Mikep86 Dec 18, 2024
e73a761
Refactor semantic text inference YAML tests
Mikep86 Dec 18, 2024
5c36db3
Refactor semantic text inference update YAML tests
Mikep86 Dec 18, 2024
4951208
Merge branch 'inference_metadata_fields' into inference_metadata_fiel…
Mikep86 Dec 19, 2024
a5bf6ea
Update semantic text field mapping YAML tests to use index setting
Mikep86 Dec 19, 2024
2661ab5
Update semantic text field mapping incompatible field mapping YAML te…
Mikep86 Dec 19, 2024
9ded814
Update semantic text inference YAML tests to use index setting
Mikep86 Dec 19, 2024
1467d22
Update semantic text inference update YAML tests to use index setting
Mikep86 Dec 19, 2024
59bc310
Remove inference metadata fields capability
Mikep86 Dec 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ tests:
- class: org.elasticsearch.xpack.inference.InferenceRestIT
method: test {p0=inference/30_semantic_text_inference/Calculates embeddings using the default ELSER 2 endpoint}
issue: https://github.com/elastic/elasticsearch/issues/117349
- class: org.elasticsearch.xpack.inference.InferenceRestIT
method: test {p0=inference/30_semantic_text_inference_bwc/Calculates embeddings using the default ELSER 2 endpoint}
issue: https://github.com/elastic/elasticsearch/issues/117349
jimczi marked this conversation as resolved.
Show resolved Hide resolved
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
method: test {p0=transform/transforms_reset/Test reset running transform}
issue: https://github.com/elastic/elasticsearch/issues/117473
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
@ServerlessScope(Scope.PUBLIC)
public class RestGetInferenceModelAction extends BaseRestHandler {
public static final String DEFAULT_ELSER_2_CAPABILITY = "default_elser_2";
public static final String INFERENCE_METADATA_FIELDS_CAPABILITY = "inference_metadata_fields";

@Override
public String getName() {
Expand Down Expand Up @@ -67,6 +66,6 @@ protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient

@Override
public Set<String> supportedCapabilities() {
return Set.of(DEFAULT_ELSER_2_CAPABILITY, INFERENCE_METADATA_FIELDS_CAPABILITY);
return Set.of(DEFAULT_ELSER_2_CAPABILITY);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ setup:
indices.create:
index: test-index
body:
settings:
index:
mapping:
semantic_text:
use_legacy_format: false
mappings:
properties:
sparse_field:
Expand All @@ -18,16 +23,6 @@ setup:

---
"Indexes sparse vector document":
- requires:
test_runner_features: [capabilities]

- skip:
reason: Test targets semantic text without inference metadata fields
capabilities:
- method: GET
path: /_inference
capabilities: [inference_metadata_fields]

# Checks mapping is not updated until first doc arrives
- do:
indices.get_mapping:
Expand All @@ -42,25 +37,28 @@ setup:
index: test-index
id: doc_1
body:
sparse_field:
text: "these are not the droids you're looking for. He's free to go around"
sparse_field: "these are not the droids you're looking for. He's free to go around"
_inference_fields.sparse_field:
inference:
inference_id: sparse-inference-id
model_settings:
task_type: sparse_embedding
chunks:
- text: "these are not the droids you're looking for"
embeddings:
feature_0: 1.0
feature_1: 2.0
feature_2: 3.0
feature_3: 4.0
- text: "He's free to go around"
embeddings:
feature_4: 0.1
feature_5: 0.2
feature_6: 0.3
feature_7: 0.4
sparse_field:
- start_offset: 0
end_offset: 44
embeddings:
feature_0: 1.0
feature_1: 2.0
feature_2: 3.0
feature_3: 4.0
- start_offset: 44
end_offset: 67
embeddings:
feature_4: 0.1
feature_5: 0.2
feature_6: 0.3
feature_7: 0.4

# Checks mapping is updated when first doc arrives
- do:
Expand All @@ -77,14 +75,6 @@ setup:
- requires:
cluster_features: "gte_v8.16.0"
reason: field_caps support for semantic_text added in 8.16.0
test_runner_features: [ capabilities ]

- skip:
reason: Test targets semantic text without inference metadata fields
capabilities:
- method: GET
path: /_inference
capabilities: [ inference_metadata_fields ]

- do:
field_caps:
Expand All @@ -111,25 +101,28 @@ setup:
index: test-index
id: doc_1
body:
sparse_field:
text: "these are not the droids you're looking for. He's free to go around"
sparse_field: "these are not the droids you're looking for. He's free to go around"
_inference_fields.sparse_field:
inference:
inference_id: sparse-inference-id
model_settings:
task_type: sparse_embedding
chunks:
- text: "these are not the droids you're looking for"
embeddings:
feature_0: 1.0
feature_1: 2.0
feature_2: 3.0
feature_3: 4.0
- text: "He's free to go around"
embeddings:
feature_4: 0.1
feature_5: 0.2
feature_6: 0.3
feature_7: 0.4
sparse_field:
- start_offset: 0
end_offset: 44
embeddings:
feature_0: 1.0
feature_1: 2.0
feature_2: 3.0
feature_3: 4.0
- start_offset: 44
end_offset: 67
embeddings:
feature_4: 0.1
feature_5: 0.2
feature_6: 0.3
feature_7: 0.4
refresh: true

- do:
Expand Down Expand Up @@ -157,16 +150,6 @@ setup:

---
"Indexes dense vector document":
- requires:
test_runner_features: [ capabilities ]

- skip:
reason: Test targets semantic text without inference metadata fields
capabilities:
- method: GET
path: /_inference
capabilities: [ inference_metadata_fields ]

# Checks mapping is not updated until first doc arrives
- do:
indices.get_mapping:
Expand All @@ -181,8 +164,8 @@ setup:
index: test-index
id: doc_2
body:
dense_field:
text: "these are not the droids you're looking for. He's free to go around"
dense_field: "these are not the droids you're looking for. He's free to go around"
_inference_fields.dense_field:
inference:
inference_id: dense-inference-id
model_settings:
Expand All @@ -191,10 +174,13 @@ setup:
similarity: cosine
element_type: float
chunks:
- text: "these are not the droids you're looking for"
embeddings: [0.04673296958208084, -0.03237321600317955, -0.02543032355606556, 0.056035321205854416]
- text: "He's free to go around"
embeddings: [0.00641461368650198, -0.0016253676731139421, -0.05126338079571724, 0.053438711911439896]
dense_field:
- start_offset: 0
end_offset: 44
embeddings: [0.04673296958208084, -0.03237321600317955, -0.02543032355606556, 0.056035321205854416]
- start_offset: 44
end_offset: 67
embeddings: [0.00641461368650198, -0.0016253676731139421, -0.05126338079571724, 0.053438711911439896]

# Checks mapping is updated when first doc arrives
- do:
Expand All @@ -211,14 +197,6 @@ setup:
- requires:
cluster_features: "gte_v8.16.0"
reason: field_caps support for semantic_text added in 8.16.0
test_runner_features: [ capabilities ]

- skip:
reason: Test targets semantic text without inference metadata fields
capabilities:
- method: GET
path: /_inference
capabilities: [ inference_metadata_fields ]

- do:
field_caps:
Expand All @@ -245,8 +223,8 @@ setup:
index: test-index
id: doc_2
body:
dense_field:
text: "these are not the droids you're looking for. He's free to go around"
dense_field: "these are not the droids you're looking for. He's free to go around"
_inference_fields.dense_field:
inference:
inference_id: dense-inference-id
model_settings:
Expand All @@ -255,10 +233,13 @@ setup:
similarity: cosine
element_type: float
chunks:
- text: "these are not the droids you're looking for"
embeddings: [ 0.04673296958208084, -0.03237321600317955, -0.02543032355606556, 0.056035321205854416 ]
- text: "He's free to go around"
embeddings: [ 0.00641461368650198, -0.0016253676731139421, -0.05126338079571724, 0.053438711911439896 ]
dense_field:
- start_offset: 0
end_offset: 44
embeddings: [0.04673296958208084, -0.03237321600317955, -0.02543032355606556, 0.056035321205854416]
- start_offset: 44
end_offset: 67
embeddings: [0.00641461368650198, -0.0016253676731139421, -0.05126338079571724, 0.053438711911439896]
refresh: true

- do:
Expand Down
Loading