# Fast Vector Highlighting is not working stable on Synonym based fields

**URL:** <https://discuss.elastic.co/t/fast-vector-highlighting-is-not-working-stable-on-synonym-based-fields/338673>\
**Category:** Elasticsearch\
**Created:** [July 18, 2023, 12:27pm UTC](https://discuss.elastic.co/t/fast-vector-highlighting-is-not-working-stable-on-synonym-based-fields/338673 "2023-07-18T12:27:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pavithra2014](https://avatars.discourse-cdn.com/v4/letter/p/cc9497/32.png) [@Pavithra2014](https://discuss.elastic.co/u/Pavithra2014)\
**Post date:** [July 18, 2023, 12:27pm UTC](https://discuss.elastic.co/t/fast-vector-highlighting-is-not-working-stable-on-synonym-based-fields/338673/1 "2023-07-18T12:27:12Z")

</div>

Here , we are using Fast Vector highlight on a field where it has the copy field for synonym . for some records FVH highlights properly but for some it is not.  
Field mapping:

```auto
title: {
type: "text",
term_vector: "with_positions_offsets",
copy_to: [
"title_synonym"
]
},
title_synonym: {
type: "text",
term_vector: "with_positions_offsets",
analyzer: "index_analyzer",
search_analyzer: "synonym_analyzer"
},

```

analyzer:

```auto
index_analyzer: {
filter: [
"lowercase",
"asciifolding"
],
type: "custom",
tokenizer: "standard"
}
synonym_analyzer: {
filter: [
"lowercase",
"synonymfile",
"asciifolding"
],
type: "custom",
tokenizer: "whitespace"
}
synonymfile: {
updateable: "true",
expand: "true",
type: "synonym_graph",
synonyms_path: "analysis/synonym.txt"
}

```

synonym.txt:  
SMP , Sample and Information

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [July 18, 2023, 3:46pm UTC](https://discuss.elastic.co/t/fast-vector-highlighting-is-not-working-stable-on-synonym-based-fields/338673/2 "2023-07-18T15:46:10Z")

</div>

Hi @Pavithra2014,

Welcome to the community! Can you give a bit more detail on a particular example which is not working for you? I assume by not working you mean it's not highlighting a particular section of text as you expect?

---

<div class="post-metadata">

**Author:** ![Pavithra2014](https://avatars.discourse-cdn.com/v4/letter/p/cc9497/32.png) [@Pavithra2014](https://discuss.elastic.co/u/Pavithra2014)\
**Post date:** [July 18, 2023, 4:05pm UTC](https://discuss.elastic.co/t/fast-vector-highlighting-is-not-working-stable-on-synonym-based-fields/338673/3 "2023-07-18T16:05:20Z")

</div>

Hi Carly ,  
I'm using "title" field alone in the highlight query but the results that are fetched are impacted with its copy field "titile\_synonym" where synonym is implemented. i want only exact query term to be highlighted not the synonym of the query term . how to do this. i'm using ES 7.6.1 version

highlight query:

```auto
 "highlight": {
    "fragmenter": "span",
    "number_of_fragments": 2,
    "fragment_size": 250,
    "encoder": "html",
    "pre_tags": [
      "<b style='background-color: #d2d2d2;'>"
    ],
    "post_tags": [
      "</b>"
    ],
    "fields": {
      "title": {
        "type": "fvh"
      }
    },
    "require_field_match": false
  }

```

---

<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:** [July 18, 2023, 4:05pm UTC](https://discuss.elastic.co/t/fast-vector-highlighting-is-not-working-stable-on-synonym-based-fields/338673/4 "2023-07-18T16:05:20Z")

</div>

7.6.1 is [EOL](https://www.elastic.co/support/eol) and no longer supported. Please upgrade ASAP.

(This is an automated response from your friendly Elastic bot. Please report this post if you have any suggestions or concerns :elasticheart: )

---

<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:** [August 15, 2023, 4:06pm UTC](https://discuss.elastic.co/t/fast-vector-highlighting-is-not-working-stable-on-synonym-based-fields/338673/5 "2023-08-15T16:06:08Z")

</div>

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