-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
Elasticsearch version: 5.0
Plugins installed: N/A
JVM version: 1.8u112
OS version: Windows Server 2012
Description of the problem including expected versus actual behavior: Highlighting dynamic fields which are stored as keyword is not working as expected. When searching over _all I would expect highlighting to occur on all fields of the result when using require_field_match: false. Example query can be found here:
My use case is that nearly every search is done for an exact value or over _all. I could get extreme performance gains by shifting dynamically created fields to Keyword, and then if full-text search is needed, defining them explicitly in the mapping. However, search highlighting is still an important part of our workflow.
Do I have a misunderstanding of how highlighting works? My interpretation is that
- We search over _all
- Hits are selected for highlighting as a postprocessing step
- Each field is matched against the original search query if require_field_match: false is set to true and the highlighting_query option is unused.
Steps to reproduce:
- Create a new index with a mapping that sets dynamic fields to type Keyword
- Add three new documents with
"message": "Kostya Test" - Run the previous query (fixing the date range)
Expected: There should be highlighted search text extracted from the _source fields that are loaded at highlight-time
Actual: No text is highlighted
The same can be repeated where the search is an exact match for the field, and no highlighting is done then either.