You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for retrieving semantic_text's indexed chunks via fields API (#132410)
Introduces the "format": "chunks" option for the fields parameter in _search requests.
Allows users to retrieve the original text chunks generated by a semantic field’s chunking strategy.
Example usage:
```
POST test-index/_search
{
"query": {
"ids" : {
"values" : ["1"]
}
},
"fields": [
{
"field": "semantic_text_field",
"format": "chunks" <1>
}
]
}
```
Copy file name to clipboardExpand all lines: x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/mapper/SemanticInferenceMetadataFieldsMapper.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -66,7 +66,7 @@ public ValueFetcher valueFetcher(MappingLookup mappingLookup, Function<Query, Bi
66
66
for (varinferenceField : mappingLookup.inferenceFields().keySet()) {
Copy file name to clipboardExpand all lines: x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/mapper/SemanticTextFieldMapper.java
Copy file name to clipboardExpand all lines: x-pack/plugin/inference/src/yamlRestTest/resources/rest-api-spec/test/inference/90_semantic_text_highlighter.yml
- match: { hits.hits.0.highlight.bbq_hnsw_field.0: "ElasticSearch is an open source, distributed, RESTful, search engine which is built on top of Lucene internally and enjoys all the features it provides." }
reason: semantic text field supports match_all query with semantic highlighter, effective from 8.19 and 9.1.0.
724
+
725
+
- do:
726
+
search:
727
+
index: test-sparse-index
728
+
body:
729
+
query:
730
+
ids: {
731
+
values: ["doc_1"]
732
+
}
733
+
highlight:
734
+
fields:
735
+
body:
736
+
type: "semantic"
737
+
number_of_fragments: 2
738
+
highlight_query: {
739
+
match_all: {}
740
+
}
741
+
742
+
- match: { hits.total.value: 1 }
743
+
- match: { hits.hits.0._id: "doc_1" }
744
+
- length: { hits.hits.0.highlight.body: 2 }
745
+
- match: { hits.hits.0.highlight.body.0: "ElasticSearch is an open source, distributed, RESTful, search engine which is built on top of Lucene internally and enjoys all the features it provides." }
746
+
- match: { hits.hits.0.highlight.body.1: "You Know, for Search!" }
0 commit comments