Thanks. My problem is that I use a copy field. Mapping:
{
"properties": {
"abstract": {
"type": "text",
"copy_to": "freetext"
},
"name": {
"type": "text",
"copy_to": "freetext"
},
"freetext": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
},
"completion": {
"type": "completion"
},
"shingle": {
"type": "search_as_you_type"
}
}
}
}
}
and search:
{
"_source": false,
"docvalue_fields": [
{
"field": "freetext.keyword"
}
],
"size": 10,
"query": {
"multi_match": {
"query": "summ",
"type": "bool_prefix",
"fields": [
"freetext.shingle",
"freetext.shingle._2gram",
"freetext.shingle._3gram"
]
}
},
"highlight": {
"fields": {
"freetext.shingle": {
"type": "unified"
}
}
}
}
It looks that the problem is that the freetext is not part of the original document. It is a copy document. I can display it with "docvalue_fields", but is it possible to get the highligting working for the copy field?