Operator "and" in highlighting

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.

On Tue, Mar 17, 2015 at 8:56 AM, Vlad Zaitsev vestild@gmail.com wrote:

But it seems that highlighter ignore operator: “and” and highlight any term

from queries.

Its much more than that. For the most part highlighters reduce the query
to a list of terms blindly. Some do phrases. They don't really have that
nuanced a view of the query itself.

Its because highlighting is totally decoupled from the actual search
portion of the job - its more like a recheck. And Lucene isn't built to
cleanly plug the highlighters into the queries. So they have tons of
instanceof style hacks to get the job done. Its not super pleasant.

Nik

--
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/CAPmjWd0t%3DHwt-mMpTSbw6B9vLBwDk8%3DsZS88F3g%2BfXATgC_SGw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.