forked from elastic/elasticsearch
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for conditional highlighting
Adds a "conditional" object under each highlighting field that can contain other fields. Those fields are highlighted based on if there was a match in the containing field. It'll let you do things like this example in the docs: This example extracts extracts the first 100 characters from `text` if there is a match in `title`, otherwise it highlights `text` as normal. { "highlight": { "fields": { "title": { "conditional": { "match": { "text": { "no_match_size": 100, "skip_matching": true } } "no_match": { "text": { "no_match_size": 100 } }, } } } } } Also adds a setting to instruct the highlighter to skip its normal match logic and just do its no_match_size stuff. This is very useful with conditional highlighting "chains" that end in a no_match_size extracting a previous entry in the chain. Like this example from the docs: { "highlight": { "fields": { "text": { "conditional": { "no_match": { "auxiliary_text": { "conditional": { "no_match": { "file_text": { "conditional": { "no_match": { "text": { "no_match_size": 100, "skip_matching": true } } } } } } } } } } } } } Closes elastic#4649
- Loading branch information
Showing
9 changed files
with
572 additions
and
187 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.