my search field is one,but I need to highlight two fields in a document? how can I achieve this Ex: my search query is match:{"file":"hello"}
I want to highlight email field also
You need to set require_field_match
value to false
as by default, only fields that contains a query match are highlighted.
{
"query": {
"match": {
"file": "hello"
}
},
"highlight": {
"require_field_match": "false",
"fields": {
"title": {},
"email": {}
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.