Skip to content

Commit d439238

Browse files
authored
Update docs for semantic chunking in 8.x (#132075)
1 parent 2b831fd commit d439238

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

docs/reference/mapping/types/semantic-text.asciidoc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,28 @@ POST test-index/_search
229229
<2> Sorts highlighted fragments by score when set to `score`.
230230
By default, fragments will be output in the order they appear in the field (order: none).
231231

232+
To use the semantic highlighter to view chunks in the order which they were indexed with no scoring, use the match_all query to retrieve them in the order they appear in the document:
233+
234+
[source,console]
235+
------------------------------------------------------------
236+
POST test-index/_search
237+
{
238+
"query": {
239+
"match_all": {}
240+
},
241+
"highlight": {
242+
"fields": {
243+
"my_semantic_field": {
244+
"number_of_fragments": 5 <1>
245+
}
246+
}
247+
}
248+
}
249+
------------------------------------------------------------
250+
// TEST[skip:Requires inference endpoint]
251+
252+
<1> This will return the first 5 chunks, set this number higher to retrieve more chunks.
253+
232254
Highlighting is supported on fields other than semantic_text.
233255
However, if you want to restrict highlighting to the semantic highlighter and return no fragments when the field is not of type semantic_text, you can explicitly enforce the `semantic` highlighter in the query:
234256

docs/reference/search/search-your-data/highlighting.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[[highlighting]]
22
=== Highlighting
33

4-
Highlighters enable you to get highlighted snippets from one or more fields
4+
Highlighters enable you to retrieve the best-matching highlighted snippets from one or more fields
55
in your search results so you can show users where the query matches are.
66
When you request highlights, the response contains an additional `highlight`
77
element for each search hit that includes the highlighted fields and the

0 commit comments

Comments
 (0)