Hi all,
When highlighting a field, i'd like to also return both fields that are associated. I have the setup below. I want to highlight comment.message, but return both comment.message and comment.id:
PUT temp-test
{
"mappings": {
"properties": {
"title": {
"type": "text"
},
"comment": {
"properties": {
"id": {
"type": "keyword"
},
"message": {
"type": "text"
}
}
}
}
}
}
POST temp-test/_doc
{
"title": "here is my document title",
"comment": [{
"id": "1",
"message": "highlight title in the message but return the id also"
},
{
"id": "2",
"message": "dont highlight this one"
}]
}
GET temp-test/_search
{
"query": {
"match": {
"title": "title"
}
},
"highlight": {
"pre_tags": [
"<b>"
],
"post_tags": [
"</b>"
],
"require_field_match": false,
"fields": {
"comment.message": {}
}
}
}