Fvh highlighter does not work with inverted proxemity search

Hi there,

I have this setup:

Mapping:

"CEDANT": {
	"type": "text",
	"analyzer":"ire_regular",
	"fields": {
		"exact":{
			"type": "text",
                  	"analyzer": "ire_exact",
                	"term_vector":"with_positions_offsets",
			"index_options" : "offsets"
		}
	}
}

Query template:

"highlight": {
	"order": "score",
	"number_of_fragments": 0,
	"type": "plain",
	"fragmenter": "span",
	"fields": {
			"CEDANT": {
                          "matched_fields": ["CEDANT"]
			},	
			"CEDANT.exact": {
                         "matched_fields": ["CEDANT.exact"],
                         "type": "fvh",
                         "no_match_size": 1000,        
                         "fragment_offset":0
  		}
}

so, if I use exact match (quoted search), CEDANT.exact is used.

Let's imagine I have a document with such sentence:
Federated Mutual Insurance

For proximity search
"Federated Insurance"~4, document match, highlighting works

But if I switch order of words:
"Insurance Federated "~4, document match, but highlighting DOES NOT work (nothing is highlighted)

Can anybody advise, how to proceed? Is it known ES bug? (I'm using ES 5.2.2) Or do I have to change some setting? I cannot use plain highlighter for exact match.

I tested the same configuration in ES 6.5.0 and it was the same issue there as well.

ES 5.2.2 supports these 3 highlighters:

  • plain (inverted proxemity search works)
  • postings (inverted proxemity search works)
  • fvh (inverted proxemity does NOT work)

ES 6.5.0 supports these 3 highlighters:

  • plain (inverted proxemity search works)
  • unified (inverted proxemity search works)
  • fvh (inverted proxemity does NOT work)

My target is to have highlighted several words in one <em></em> tag:
for query "Federated Mutual Insurance"
I need to have highlighted (fvh):
<em>Federated Mutual Insurance</em>,
and not (plain/postings/unified):
<em>Federated</em> <em>Mutual</em> <em>Insurance</em>

This indeed looks like a bug in the fvh highlighter. The unified highlighter is the replacement for the fvh so you should switch to this new highlighter that also uses the terms vector if they are indexed in the field.

My target is to have highlighted several words in one <em></em> tag:
for query "Federated Mutual Insurance"

There is an open issue for this one, https://github.com/elastic/elasticsearch/issues/29561, but it is not resolved yet so each term is highlighted independently. We are working on a fix for this but it should land in the 7x version.

Thank you @jimczi
I just tested locally in ES 7.0Beta, but issue is still there (since still open, it's expected)

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.