[ES|QL][Discover] Highlight results when using ES|QL highlight#271519
Merged
Conversation
…into highlight-results
sddonne
commented
May 28, 2026
| } | ||
|
|
||
| const highlights = hit.raw.highlight ?? {}; | ||
| const highlights = hit.raw.highlight ?? hit.raw.inline_highlights ?? {}; |
Contributor
Author
There was a problem hiding this comment.
Used to order highlighted fields at the start of the summary column.
|
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
|
Pinging @elastic/kibana-esql (Team:ESQL) |
davismcphee
approved these changes
May 29, 2026
Contributor
davismcphee
left a comment
There was a problem hiding this comment.
Code changes look very nice and it works well, thanks!
stratoula
reviewed
May 29, 2026
Contributor
stratoula
left a comment
There was a problem hiding this comment.
This is a very nice enhancement, I like it a lot. Some very tiny comments!
| } | ||
| }); | ||
| return columns; | ||
| return replaceColumnNamesIfRenamed(root, columns); |
Contributor
💛 Build succeeded, but was flaky
Failed CI Steps
Test Failures
Metrics [docs]Module Count
Async chunks
Page load bundle
History
|
dej611
pushed a commit
to dej611/kibana
that referenced
this pull request
May 29, 2026
…ic#271519) - Closes elastic#190293 ## Summary This PR adds highlighting support for ES|QL. <img width="1905" height="866" alt="image" src="https://github.com/user-attachments/assets/d806ccc1-165e-46f6-a7f7-57258ac03191" /> ### How does highlighting work? DSL and ES|QL highlights do not work in the same way: - DSL keeps the value unchanged and return an extra 'highlight' field in the hit that contains substrings to be highlighted. - ES|QL directly inlines the highlighting tags inside the result value, not additional information is received in the result. ### Implementation details In order to leverage the current fields formatter architecture, we decorate the Discover hit with a new `inline_highlights` field when it's detected that the query result has been highlighted. It contains the highlighted columns and which tags has been used for highlighting on each of them (could be different). Then when the field formatter receives the `hit` it can decide which algorithm to use. See elastic#270394 for alternatives discussed. ### Checklist - [x] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Stratou <efstratia.kalafateli@elastic.co>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds highlighting support for ES|QL.
How does highlighting work?
DSL and ES|QL highlights do not work in the same way:
Implementation details
In order to leverage the current fields formatter architecture, we decorate the Discover hit with a new
inline_highlightsfield when it's detected that the query result has been highlighted. It contains the highlighted columns and which tags has been used for highlighting on each of them (could be different).Then when the field formatter receives the
hitit can decide which algorithm to use.See #270394 for alternatives discussed.
Checklist
release_note:*label is applied per the guidelines