innerHits highlight issue with _source disabled #66524
Labels
>bug
>regression
:Search Foundations/Mapping
Index mappings, including merging and defining field types
Team:Search Foundations
Meta label for the Search Foundations team in Elasticsearch
*Elasticsearch version : 7.10.1
Plugins installed: none
JVM version : embedded jvm
*OS version: Darwin Kernel Version 19.6.0, 8.04.1-Ubuntu SMP
Description of the problem including expected versus actual behavior:
A text field with indexed offsets in a nested document produces an error when querying with highlights. We use stored fields and not the _source.
The following error occurs:
"type": "illegal_state_exception",
"reason": "extracted source isn't an object or an array"
There is only one place in the src where this message is thrown:
https://github.com/elastic/elasticsearch/blob/master/server/src/main/java/org/elasticsearch/search/fetch/FetchPhase.java
This recent work seems to be relevant: #65292
Steps to reproduce:
curl -X DELETE "http://localhost:9200/bugtest"
curl -X PUT "http://localhost:9200/bugtest/" -d '{ "mappings": { "_source": { "enabled": false }, "properties": { "text": { "type": "text", "store": true, "index_options": "offsets" }, "page": { "type": "nested", "properties": { "text": { "type": "text", "store": true, "index_options": "offsets" } } } } } }' -H 'Content-Type: application/json'
curl -X PUT "http://localhost:9200/bugtest/_doc/testdoc" -d '{ "text": "test text with nothing else than a simple test", "page": [ {"text": "test text with nothing else than a simple test"}, {"text": "test two"} ] }' -H 'Content-Type: application/json'
curl -X POST "http://localhost:9200/bugtest/_search" -d '{ "query": { "nested": { "path": "page", "query": { "match": {"page.text" : "test"} }, "inner_hits": { "stored_fields": ["page.text"], "highlight" : { "fields" : { "page.text": {"type": "unified"} } } } } } } ' -H 'Content-Type: application/json'
The text was updated successfully, but these errors were encountered: