Skip to content

Commit 9f4e40d

Browse files
committed
Yaml
1 parent 3c1b802 commit 9f4e40d

3 files changed

Lines changed: 49 additions & 4 deletions

File tree

x-pack/plugin/inference/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ apply plugin: 'elasticsearch.internal-test-artifact'
1212

1313
restResources {
1414
restApi {
15-
include '_common', 'bulk', 'indices', 'inference', 'index', 'get', 'update', 'reindex', 'search', 'field_caps', 'capabilities'
15+
include '_common', 'bulk', 'cluster', 'indices', 'inference', 'index', 'get', 'update', 'reindex', 'search', 'field_caps', 'capabilities'
1616
}
1717
}
1818

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,11 @@ public class InferenceFeatures implements FeatureSpecification {
4949
private static final NodeFeature COHERE_V2_API = new NodeFeature("inference.cohere.v2");
5050
public static final NodeFeature SEMANTIC_TEXT_HIGHLIGHTING_FLAT = new NodeFeature("semantic_text.highlighter.flat_index_options");
5151
private static final NodeFeature SEMANTIC_TEXT_FIELDS_CHUNKS_FORMAT = new NodeFeature("semantic_text.fields_chunks_format");
52+
private static final NodeFeature CHUNK_RESCORER_TELEMETRY = new NodeFeature("retrievers.extended_telemetry_chunk_rescorer");
5253

5354
@Override
5455
public Set<NodeFeature> getTestFeatures() {
55-
var testFeatures = new HashSet<>(
56+
return new HashSet<>(
5657
Set.of(
5758
SemanticTextFieldMapper.SEMANTIC_TEXT_IN_OBJECT_FIELD_FIX,
5859
SemanticTextFieldMapper.SEMANTIC_TEXT_SINGLE_FIELD_UPDATE_FIX,
@@ -87,9 +88,9 @@ public Set<NodeFeature> getTestFeatures() {
8788
SemanticQueryBuilder.SEMANTIC_QUERY_MULTIPLE_INFERENCE_IDS,
8889
SemanticQueryBuilder.SEMANTIC_QUERY_FILTER_FIELD_CAPS_FIX,
8990
InterceptedInferenceQueryBuilder.NEW_SEMANTIC_QUERY_INTERCEPTORS,
90-
TEXT_SIMILARITY_RERANKER_SNIPPETS
91+
TEXT_SIMILARITY_RERANKER_SNIPPETS,
92+
CHUNK_RESCORER_TELEMETRY
9193
)
9294
);
93-
return testFeatures;
9495
}
9596
}

x-pack/plugin/inference/src/yamlRestTest/resources/rest-api-spec/test/inference/70_text_similarity_rank_retriever.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,3 +859,47 @@ setup:
859859

860860
- match: { hits.hits.0._id: "doc_1" }
861861
- match: { hits.hits.1._id: "doc_2" }
862+
863+
---
864+
"Chunk rescorer usage is accurately reflected in cluster stats":
865+
866+
- requires:
867+
cluster_features: "retrievers.extended_telemetry_chunk_rescorer"
868+
reason: rescore_chunks introduced in 9.2.0
869+
870+
# Start with empty cluster stats
871+
- do:
872+
cluster.stats: {}
873+
874+
- match: { indices.search: {total: 0, queries: {}, rescorers: {}, sections: {}, retrievers: {}, extended: {}}}
875+
876+
- do:
877+
search:
878+
index: test-index
879+
body:
880+
track_total_hits: true
881+
fields: [ "text", "semantic_text_field", "topic" ]
882+
retriever:
883+
text_similarity_reranker:
884+
retriever:
885+
standard:
886+
query:
887+
match:
888+
topic:
889+
query: "science"
890+
rank_window_size: 10
891+
inference_id: my-rerank-model
892+
inference_text: "how often does the moon hide the sun?"
893+
field: semantic_text_field
894+
chunk_rescorer: { }
895+
size: 10
896+
897+
# Should now be populated with retriever usage from the query we just ran
898+
- do:
899+
cluster.stats: { }
900+
901+
- match: { indices.search.total: 1 }
902+
- match: { indices.search.queries.match: 1 }
903+
- match: { indices.search.retrievers.text_similarity_reranker: 1 }
904+
- match: { indices.search.retrievers.standard: 1 }
905+
- match: { indices.search.extended.retrievers.text_similarity_reranker.chunk_rescorer: 1 }

0 commit comments

Comments
 (0)