-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Clarify highlighting docs for semantic_text and interacting with chunks #131871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
e39b65c
134104d
d9d105e
8cae0f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -267,9 +267,29 @@ POST test-index/_search | |
``` | ||
|
||
1. Specifies the maximum number of fragments to return. | ||
2. Sorts highlighted fragments by score when set to `score`. By default, | ||
2. Sorts returned most relevant highlighted fragments by score when set to `score`. By default, | ||
fragments will be output in the order they appear in the field (order: none). | ||
|
||
To use the `semantic` highlighter to view indexed chunks in the order which they | ||
were indexed and no scoring, | ||
use the `match_all` query to retrieve each chunk in the order which it appears | ||
in the document: | ||
kderusso marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
```console | ||
POST test-index/_search | ||
{ | ||
"query": { | ||
"match_all": {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Samiul-TheSoccerFan what version should this be tagged with? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was backported all the way to |
||
}, | ||
"highlight": { | ||
"fields": { | ||
"my_semantic_field": { | ||
"number_of_fragments": 5 | ||
|
||
} | ||
} | ||
} | ||
} | ||
|
||
Highlighting is supported on fields other than semantic_text. 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 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ applies_to: | |
|
||
# Highlighting [highlighting] | ||
|
||
Highlighters enable you to get highlighted snippets from one or more fields in your search results so you can show users where the query matches are. When you request highlights, the response contains an additional `highlight` element for each search hit that includes the highlighted fields and the highlighted fragments. | ||
Highlighters enable you to retrieve the best-matching highlighted snippets from one or more fields in your search results so you can show users where the query matches are. When you request highlights, the response contains an additional `highlight` element for each search hit that includes the highlighted fields and the highlighted fragments. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice light-touch change 👍 |
||
|
||
::::{note} | ||
Highlighters don’t reflect the boolean logic of a query when extracting terms to highlight. Thus, for some complex boolean queries (e.g nested boolean queries, queries using `minimum_should_match` etc.), parts of documents may be highlighted that don’t correspond to query matches. | ||
|
Uh oh!
There was an error while loading. Please reload this page.