The terms "Palais" and "Louvre" are not highlighted in the appellation_courante field. They are in the commune field.
After some investigation it seems related to being include to _all field or not:
The fields are mapped differently:
"monument": {
"include_in_all":false,
"properties": {
"appellation_courante": {
"type": "text",
"include_in_all": true,
"analyzer": "french"
},
"commune": {
"type": "text"
},
Manually executing the query in Elasticsearch
No highlighting:
POST monument/_search
{
"query": {
"match": {
"_all": "Palais du Louvre"
}
},
"highlight": {"fields": {
"appellation_courante":{}
}
}
}
POST monument/_search
{
"query": {
"query_string": {
"query": "Palais du Louvre"
}
},
"highlight": {"fields": {
"appellation_courante":{}
}
}
}
Highlighting is OK:
POST monument/_search
{
"query": {
"match": {
"appellation_courante": "Palais du Louvre"
}
},
"highlight": {"fields": {
"appellation_courante":{}
}
}
}
POST monument/_search
{
"query": {
"query_string": {
"query": "appellation_courante:Palais du Louvre"
}
},
"highlight": {"fields": {
"appellation_courante":{}
}
}
}