My question is, can an Elastic Query be written, such that I can implement highlighting against specific filters that I write? For example, suppose I have the following bool filters applied to my query:
{
"query_string": {
"query": "Harry Potter",
"fields": [
"document.metadata.title^1.0",
],
...
},
},
{
"query_string": {
"query": "Rowling",
"fields": [
"document.metadata.author^1.0",
],
...
},
},
]
...
"highlight" {
"fields": {
"report.metadata.title":{
"fragment_size": 100
},
"report.metadata.author":{
"fragment_size": 100
}
}
}
In this scenario, I wish to report highlighting on the following:
1. Title contains "Harry Potter" - Highlighting = TRUE
2. Author contains "Harry Potter" - Highlighting = FALSE
3. Title contains "Rowling" - Highlighting = FALSE
4. Author contains "Rowling" - Highlighting = TRUE
Is this possible? Many thanks in advance