# Fvh highlighter does not work with inverted proxemity search

**URL:** <https://discuss.elastic.co/t/fvh-highlighter-does-not-work-with-inverted-proxemity-search/170916>\
**Category:** Elasticsearch\
**Created:** [March 5, 2019, 1:48pm UTC](https://discuss.elastic.co/t/fvh-highlighter-does-not-work-with-inverted-proxemity-search/170916 "2019-03-05T13:48:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![astrodi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/astrodi/32/117732_2.png) [@astrodi](https://discuss.elastic.co/u/astrodi)\
**Post date:** [March 5, 2019, 1:48pm UTC](https://discuss.elastic.co/t/fvh-highlighter-does-not-work-with-inverted-proxemity-search/170916/1 "2019-03-05T13:48:11Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/d/fdf236866a4faaeeaeede7ff5105c79f33598c6b.png)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/c/4/c47996177c5684d3912582a360997b899c2e07e8.png)

---

<div class="post-metadata">

**Author:** ![astrodi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/astrodi/32/117732_2.png) [@astrodi](https://discuss.elastic.co/u/astrodi)\
**Post date:** [March 6, 2019, 8:58am UTC](https://discuss.elastic.co/t/fvh-highlighter-does-not-work-with-inverted-proxemity-search/170916/2 "2019-03-06T08:58:47Z")

</div>

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>`

---

<div class="post-metadata">

**Author:** ![jimczi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jimczi/32/47985_2.png) [@jimczi](https://discuss.elastic.co/u/jimczi)\
**Post date:** [March 15, 2019, 8:28am UTC](https://discuss.elastic.co/t/fvh-highlighter-does-not-work-with-inverted-proxemity-search/170916/3 "2019-03-15T08:28:02Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![astrodi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/astrodi/32/117732_2.png) [@astrodi](https://discuss.elastic.co/u/astrodi)\
**Post date:** [March 15, 2019, 3:00pm UTC](https://discuss.elastic.co/t/fvh-highlighter-does-not-work-with-inverted-proxemity-search/170916/4 "2019-03-15T15:00:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 12, 2019, 3:00pm UTC](https://discuss.elastic.co/t/fvh-highlighter-does-not-work-with-inverted-proxemity-search/170916/5 "2019-04-12T15:00:09Z")

</div>

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