# ES 6.4.3 Highlight response has unexpected content for query\_string type of query

**URL:** <https://discuss.elastic.co/t/es-6-4-3-highlight-response-has-unexpected-content-for-query-string-type-of-query/207950>\
**Category:** Elasticsearch\
**Created:** [November 14, 2019, 6:07pm UTC](https://discuss.elastic.co/t/es-6-4-3-highlight-response-has-unexpected-content-for-query-string-type-of-query/207950 "2019-11-14T18:07:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![amitbyahoo](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@amitbyahoo](https://discuss.elastic.co/u/amitbyahoo)\
**Post date:** [November 14, 2019, 6:07pm UTC](https://discuss.elastic.co/t/es-6-4-3-highlight-response-has-unexpected-content-for-query-string-type-of-query/207950/1 "2019-11-14T18:07:23Z")

</div>

Hi

I was able to get highlighting to work correctly with some sample queries from documentation website. However, for my real queries I am facing a strange problem where the highlight tags are displayed many times over for blank tokens. My real query is a function\_score query but since we have a native Java scoring script I decided to test with just the query portion. I see the problem there as well.

**Request:**

POST ire-ire-customer-entity/\_search

{ "query":{"query\_string":{"query":"((demetrius~ AND steyer) OR (demetrius AND steyer~) OR (demetrius~ AND percy) OR (demetrius AND percy~) OR (percy~ AND steyer) OR (percy AND steyer~))","default\_field":"Name","fields":,"type":"best\_fields","default\_operator":"or","analyzer":"analyzer\_qs\_Name","max\_determinized\_states":10000,"enable\_position\_increments":true,"fuzziness":"AUTO","fuzzy\_prefix\_length":0,"fuzzy\_max\_expansions":50,"phrase\_slop":0,"escape":false,"auto\_generate\_synonyms\_phrase\_query":true,"fuzzy\_transpositions":true,"boost":1.0}},"min\_score":0.8, "\_source": "Name", "highlight": {"fields": {"Name" : {"type": "plain"}}}}

**Response:**

{

"took": 51,

"timed\_out": false,

"\_shards": {

```
"total": 1,

"successful": 1,

"skipped": 0,

"failed": 0

```

},

"hits": {

```
"total": 27,

"max_score": 109.12074,

"hits": [

  {

    "_index": "ire-ire-customer-entity-191105050740",

    "_type": "Customer",

    "_id": "Occupancies:12009939.Customer[1]",

    "_score": 109.12074,

    "_routing": "9",

    "_source": {

      "Name": "Demetrius Percy Steyer"

    },

    "highlight": {

      "Name": [

        "<em></em><em></em><em></em><em></em><em></em><em></em>Demetrius Percy Steyer"

      ]

    }

  },

 {

    "_index": "ire-ire-customer-entity-191105050740",

    "_type": "Customer",

    "_id": "Occupancies:12009945.Customer[1]",

    "_score": 109.12074,

    "_routing": "9",

    "_source": {

      "Name": "Demetrius Percy Steyer"

    },

    "highlight": {

      "Name": [

        "<em></em><em></em><em></em><em></em><em></em><em></em>Demetrius Percy Steyer"

      ]

    }

  },

  {

    "_index": "ire-ire-customer-entity-191105050740",

    "_type": "Customer",

    "_id": "Occupancies:12009948.Customer[1]",

    "_score": 109.12074,

    "_routing": "9",

    "_source": {

      "Name": "Demetrius Percy Steyer"

    },

    "highlight": {

      "Name": [

        "<em></em><em></em><em></em><em></em><em></em><em></em>Demetrius Percy Steyer"

      ]

    }

  },

  {

    "_index": "ire-ire-customer-entity-191105050740",

    "_type": "Customer",

    "_id": "Occupancies:12009936.Customer[1]",

    "_score": 109.12074,

    "_routing": "9",

    "_source": {

      "Name": "Demetrius Percy Steyer"

    },

    "highlight": {

      "Name": [

        "<em></em><em></em><em></em><em></em><em></em><em></em>Demetrius Percy Steyer"

      ]

    }

  },

  {

    "_index": "ire-ire-customer-entity-191105050740",

    "_type": "Customer",

    "_id": "Occupancies:12009938.Customer[1]",

    "_score": 109.12074,

    "_routing": "9",

    "_source": {

      "Name": "Demetrius Percy Steyer"

    },

    "highlight": {

      "Name": [

        "<em></em><em></em><em></em><em></em><em></em><em></em>Demetrius Percy Steyer"

      ]

    }

  },

  {

    "_index": "ire-ire-customer-entity-191105050740",

    "_type": "Customer",

    "_id": "Occupancies:12009928.Customer[1]",

    "_score": 109.12074,

    "_routing": "9",

    "_source": {

      "Name": "Demetrius Percy Steyer"

    },

    "highlight": {

      "Name": [

        "<em></em><em></em><em></em><em></em><em></em><em></em>Demetrius Percy Steyer"

      ]

    }

  },

  {

    "_index": "ire-ire-customer-entity-191105050740",

    "_type": "Customer",

    "_id": "Occupancies:12009932.Customer[1]",

    "_score": 109.12074,

    "_routing": "9",

    "_source": {

      "Name": "Demetrius Percy Steyer"

    },

    "highlight": {

      "Name": [

        "<em></em><em></em><em></em><em></em><em></em><em></em>Demetrius Percy Steyer"

      ]

    }

  },

  {

    "_index": "ire-ire-customer-entity-191105050740",

    "_type": "Customer",

    "_id": "Occupancies:12009947.Customer[1]",

    "_score": 109.12074,

    "_routing": "9",

    "_source": {

      "Name": "Demetrius Percy Steyer"

    },

    "highlight": {

      "Name": [

        "<em></em><em></em><em></em><em></em><em></em><em></em>Demetrius Percy Steyer"

      ]

    }

  },

  {

    "_index": "ire-ire-customer-entity-191105050740",

    "_type": "Customer",

    "_id": "Occupancies:12009931.Customer[1]",

    "_score": 109.12074,

    "_routing": "9",

    "_source": {

      "Name": "Demetrius Percy Steyer"

    },

    "highlight": {

      "Name": [

        "<em></em><em></em><em></em><em></em><em></em><em></em>Demetrius Percy Steyer"

      ]

    }

  },

  {

    "_index": "ire-ire-customer-entity-191105050740",

    "_type": "Customer",

    "_id": "Occupancies:12009950.Customer[1]",

    "_score": 109.12074,

    "_routing": "9",

    "_source": {

      "Name": "Demetrius Percy Steyer"

    },

    "highlight": {

      "Name": [

        "<em></em><em></em><em></em><em></em><em></em><em></em>Demetrius Percy Steyer"

      ]

    }

  }

]

```

}

}

---

<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:** [December 12, 2019, 6:07pm UTC](https://discuss.elastic.co/t/es-6-4-3-highlight-response-has-unexpected-content-for-query-string-type-of-query/207950/2 "2019-12-12T18:07:38Z")

</div>

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