I noticed some strange behavior of highlighter. It works in a different way
to search.
See example.
request:
{
"highlight": {
"pre_tags": [
""
],
"post_tags": [
""
],
"fields": {
"message": {}
}
},
"query": {
"constant_score": {
"query": {
"bool": {
"should": [
{
"multi_match": {
"query": "meat",
"analyzer": "standard",
"operator": "and",
"fields": [
"message"
]
}
},
{
"multi_match": {
"query": "fresh cucumbers",
"analyzer": "standard",
"operator": "and",
"fields": [
"message"
]
}
}
]
}
}
}
}
}
Response:
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "test",
"_type": "test",
"_id": "1",
"_score": 1,
"_source": {
"message": "meat, flacky cucumbers"
},
"highlight": {
"message": [
"meat, flacky cucumbers"
]
}
}
]
}
}
"meat, flacky cucumbers" would not be found by "query": "fresh cucumbers",
"analyzer": "standard", "operator": "and"
But it seems that highlighter ignore operator: “and” and highlight any term
from queries.
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/eee2fd27-a852-4eb3-915d-5a4196e7aafa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.