Skip to content

Commit 3d68e73

Browse files
committed
move doc section
1 parent 564b9c1 commit 3d68e73

File tree

1 file changed

+25
-46
lines changed

1 file changed

+25
-46
lines changed

docs/reference/elasticsearch/mapping-reference/semantic-text.md

Lines changed: 25 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -339,27 +339,6 @@ POST test-index/_search
339339
2. Sorts the most relevant highlighted fragments by score when set to `score`. By default,
340340
fragments will be output in the order they appear in the field (order: none).
341341

342-
To use the `semantic` highlighter to view chunks in the order which they were indexed with no scoring,
343-
use the `match_all` query to retrieve them in the order they appear in the document:
344-
345-
```console
346-
POST test-index/_search
347-
{
348-
"query": {
349-
"match_all": {}
350-
},
351-
"highlight": {
352-
"fields": {
353-
"my_semantic_field": {
354-
"number_of_fragments": 5 <1>
355-
}
356-
}
357-
}
358-
}
359-
```
360-
361-
1. This will return the first 5 chunks, set this number higher to retrieve more chunks.
362-
363342
Highlighting is supported on fields other than semantic_text. However, if you
364343
want to restrict highlighting to the semantic highlighter and return no
365344
fragments when the field is not of type semantic_text, you can explicitly
@@ -387,6 +366,31 @@ PUT test-index
387366

388367
1. Ensures that highlighting is applied exclusively to semantic_text fields.
389368

369+
To retrieve all fragments from the `semantic` highlighter in their original indexing order
370+
without scoring, use a `match_all` query as the `highlight_query`.
371+
This ensures fragments are returned in the order they appear in the document:
372+
373+
```console
374+
POST test-index/_search
375+
{
376+
"query": {
377+
"ids": {
378+
"values": ["1"]
379+
}
380+
},
381+
"highlight": {
382+
"fields": {
383+
"my_semantic_field": {
384+
"number_of_fragments": 5, <1>
385+
"highlight_query": { "match_all": {} }
386+
}
387+
}
388+
}
389+
}
390+
```
391+
392+
1. Returns the first 5 fragments. Increase this value to retrieve additional fragments.
393+
390394
## Updates and partial updates for `semantic_text` fields [semantic-text-updates]
391395

392396
When updating documents that contain `semantic_text` fields, it’s important to understand how inference is triggered:
@@ -450,31 +454,6 @@ PUT my-index-000004
450454
}
451455
```
452456

453-
To retrieve all fragments from the `semantic` highlighter in their original indexing order
454-
without scoring, use a `match_all` query as the `highlight_query`.
455-
This ensures fragments are returned in the order they appear in the document:
456-
457-
```console
458-
POST test-index/_search
459-
{
460-
"query": {
461-
"ids": {
462-
"values": ["1"]
463-
}
464-
},
465-
"highlight": {
466-
"fields": {
467-
"my_semantic_field": {
468-
"number_of_fragments": 5, <1>
469-
"highlight_query": { "match_all": {} }
470-
}
471-
}
472-
}
473-
}
474-
```
475-
476-
1. Returns the first 5 fragments. Increase this value to retrieve additional fragments.
477-
478457
## Updates to `semantic_text` fields [update-script]
479458

480459
For indices containing `semantic_text` fields, updates that use scripts have the

0 commit comments

Comments
 (0)