Im indexing some text using the annotated text plugin eg
DELETE test1
PUT test
{
"settings": {
"number_of_shards": 1
},
"mappings": {
"properties":{
"text":{
"type":"annotated_text"
}
}
}
}
POST test/_doc/1
{
"text":"he had a meeting with the [President of Mexico](Andrés+Obrador&Mexico) today"
}
When I perform a search with highlighting for a specific field all is good:
POST test/_search
{
"query": {
"term": {
"text": "Andrés Obrador"
}
},
"highlight": {
"type": "annotated",
"fields": {
"text": {}
}
}
}
"hits": [
{
"_index": "test",
"_type": "_doc",
"_id": "1",
"_score": 0.30873197,
"_source": {
"text": "he had a meeting with the [President of Mexico](Andrés+Obrador&Mexico) today"
},
"highlight": {
"text": [
"he had a meeting with the [President of Mexico](_hit_term=Andr%C3%A9s+Obrador&Andr%C3%A9s+Obrador&Mexico) today"
]
}
}
]
However if I perform the same search with a wildcard field the highlighting vanishes:
POST test/_search
{
"query": {
"term": {
"text": "Andrés Obrador"
}
},
"highlight": {
"type": "annotated",
"fields": {
"*": {}
}
}
}
"hits": [
{
"_index": "test",
"_type": "_doc",
"_id": "1",
"_score": 0.30873197,
"_source": {
"text": "he had a meeting with the [President of Mexico](Andrés+Obrador&Mexico) today"
}
}
]