Skip to content

Commit 08460f3

Browse files
authored
Update docs for semantic chunking in 8.x (#132075) (#132081)
1 parent 11ad286 commit 08460f3

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
@@ -149,6 +149,28 @@ POST test-index/_search
149149
<1> Specifies the maximum number of fragments to return.
150150
<2> Sorts highlighted fragments by score when set to `score`. By default, fragments will be output in the order they appear in the field (order: none).
151151

152+
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:
153+
154+
[source,console]
155+
------------------------------------------------------------
156+
POST test-index/_search
157+
{
158+
"query": {
159+
"match_all": {}
160+
},
161+
"highlight": {
162+
"fields": {
163+
"my_semantic_field": {
164+
"number_of_fragments": 5 <1>
165+
}
166+
}
167+
}
168+
}
169+
------------------------------------------------------------
170+
// TEST[skip:Requires inference endpoint]
171+
172+
<1> This will return the first 5 chunks, set this number higher to retrieve more chunks.
173+
152174
Highlighting is supported on fields other than semantic_text.
153175
However, if you want to restrict highlighting to the semantic highlighter and return no fragments when the field is not of type semantic_text,
154176
you can explicitly enforce the `semantic` highlighter in the query:

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)