# FVH does not highlight matched search terms on snippets boundary

**URL:** <https://discuss.elastic.co/t/fvh-does-not-highlight-matched-search-terms-on-snippets-boundary/298720>\
**Category:** Elasticsearch\
**Created:** [March 3, 2022, 9:57am UTC](https://discuss.elastic.co/t/fvh-does-not-highlight-matched-search-terms-on-snippets-boundary/298720 "2022-03-03T09:57:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anatoly\_Petkevich](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anatoly_petkevich/32/97607_2.png) [@Anatoly\_Petkevich](https://discuss.elastic.co/u/Anatoly_Petkevich)\
**Post date:** [March 3, 2022, 9:57am UTC](https://discuss.elastic.co/t/fvh-does-not-highlight-matched-search-terms-on-snippets-boundary/298720/1 "2022-03-03T09:57:23Z")

</div>

Looks like there is an issue with highlighting of matched terms on snippets boundary.  
Steps to reproduce:

1. Create index and field mappings

```auto
PUT /test
{
  "settings": {
    "number_of_shards": 1
  },
  "mappings": {
    "properties": {
      "title": {
        "type": "text",
        "term_vector": "with_positions_offsets",
        "analyzer": "english",
        "fields": {
          "exactmatch": {
            "type": "text",
            "term_vector": "with_positions_offsets",
            "analyzer": "standard"
          }
        }
      }
    }
  }
}

```

1. Index document

```auto
POST test/_doc/
{
  "title": "The concerns span an array of emergencies over four administrations, including infectious-disease outbreaks such as Ebola and Zika and extreme weather events."
}

```

1. As an extreme case, search for entire field text

```auto
POST /test/_search
{
  "query": {
    "multi_match": {
      "fields": [
        "title",
        "title.exactmatch^10"
      ],
      "operator": "and",
      "query": "The concerns span an array of emergencies over four administrations, including infectious-disease outbreaks such as Ebola and Zika and extreme weather events.",
      "type": "best_fields",
      "zero_terms_query": "all"
    }
  },
  "highlight": {
    "number_of_fragments": 2,
    "fragment_size": 70,
    "boundary_max_scan": 20,
    "boundary_scanner": "word",
    "encoder": "html",
    "fields": {
      "title": {
        "matched_fields": [
          "title",
          "title.exactmatch"
        ],
        "type": "fvh"
      }
    }
  }
}

```

The term "including" is not highlighted in returned snippets :

```auto
        "highlight" : {
          "title" : [
            "<em>The</em> <em>concerns</em> <em>span</em> <em>an</em> <em>array</em> <em>of</em> <em>emergencies</em> <em>over</em> <em>four</em> <em>administrations</em>, including",
            "including <em>infectious</em>-<em>disease</em> <em>outbreaks</em> <em>such</em> <em>as</em> <em>Ebola</em> <em>and</em> <em>Zika</em> <em>and</em> <em>extreme</em> weather"
          ]

```

Is such inconsistent behavior a limitation of FVH highlighter or a bug?  
Elasticsearch version - 7.10.1

---

<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:** [March 31, 2022, 9:57am UTC](https://discuss.elastic.co/t/fvh-does-not-highlight-matched-search-terms-on-snippets-boundary/298720/2 "2022-03-31T09:57:47Z")

</div>

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