# Highlight produce unexpected invalid results on multivalue fields copied from other fields

**URL:** <https://discuss.elastic.co/t/highlight-produce-unexpected-invalid-results-on-multivalue-fields-copied-from-other-fields/317394>\
**Category:** Elasticsearch\
**Created:** [October 25, 2022, 10:07am UTC](https://discuss.elastic.co/t/highlight-produce-unexpected-invalid-results-on-multivalue-fields-copied-from-other-fields/317394 "2022-10-25T10:07:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maxim\_Kollegov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/maxim_kollegov/32/98686_2.png) [@Maxim\_Kollegov](https://discuss.elastic.co/u/Maxim_Kollegov)\
**Post date:** [October 25, 2022, 10:07am UTC](https://discuss.elastic.co/t/highlight-produce-unexpected-invalid-results-on-multivalue-fields-copied-from-other-fields/317394/1 "2022-10-25T10:07:18Z")

</div>

Steps to reproduce

1. create mapping

```auto
post /test/_mapping 
{
    "properties": {
      
      "family": {
            "type": "text",
            "index": true,
            "term_vector": "with_positions_offsets",
            "store": false
      },
      "person":{
            "type": "keyword",
            "index": true,
            "store": true,
            "copy_to":["family"]
      },
      "sisters":{
            "type": "keyword",
            "index": true,
            "store": true,
            "copy_to":["family"]
      },
      "brothers":{
            "type": "keyword",
            "index": true,
            "store": true,
            "copy_to":["family"]
      }
    }
}

```

1. post a document

```auto
POST /test/_doc/1
{
  "person":"john doe jr",
  "sisters":["pam doe jr","ann doe older"],
  "brothers":["peter doe jr third"]
}

```

3 Perform search

```auto
POST /test/_search
{
  "query":{
    "match": {
      "family": "doe jr"
    }
  },
  "highlight": {
    "fields": {
          "family": { }
    }
  }
}

```

Unexpected invalid results of highlighter

```auto
"highlight": {
          "family": [
            "john <em>doe</em> <em>jr</em>",
            "pete<em>r d</em>o<em>e </em>jr th<em>ird</em>",
            "a<em>nn </em>d<em>oe</em> older"
          ]
        }

```

---

<div class="post-metadata">

**Author:** ![Maxim\_Kollegov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/maxim_kollegov/32/98686_2.png) [@Maxim\_Kollegov](https://discuss.elastic.co/u/Maxim_Kollegov)\
**Post date:** [October 26, 2022, 12:24pm UTC](https://discuss.elastic.co/t/highlight-produce-unexpected-invalid-results-on-multivalue-fields-copied-from-other-fields/317394/2 "2022-10-26T12:24:27Z")

</div>

Forgot to mention server Version is 8.4.1

Please, Can anybody check and confirm this bug

---

<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:** [November 23, 2022, 12:24pm UTC](https://discuss.elastic.co/t/highlight-produce-unexpected-invalid-results-on-multivalue-fields-copied-from-other-fields/317394/3 "2022-11-23T12:24:44Z")

</div>

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