# Show highlights for matched terms query (for integer values)

**URL:** <https://discuss.elastic.co/t/show-highlights-for-matched-terms-query-for-integer-values/305080>\
**Category:** Elasticsearch\
**Created:** [May 18, 2022, 2:04pm UTC](https://discuss.elastic.co/t/show-highlights-for-matched-terms-query-for-integer-values/305080 "2022-05-18T14:04:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pyppe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pyppe/32/3531_2.png) [@Pyppe](https://discuss.elastic.co/u/Pyppe)\
**Post date:** [May 18, 2022, 2:04pm UTC](https://discuss.elastic.co/t/show-highlights-for-matched-terms-query-for-integer-values/305080/1 "2022-05-18T14:04:42Z")

</div>

We've got a mapping for field `classes`:

```json
"classes" : { "type" : "integer" }

```

Is there a way to show highlight for the matching classes if we search it e.g. via terms-query:

```json
{
  "terms" : {
    "classes" : [1, 5, 10]
  }
}

```

Even if we define the field in `"highlight"` it doesn't come up.

Thanks!

---

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [May 18, 2022, 4:06pm UTC](https://discuss.elastic.co/t/show-highlights-for-matched-terms-query-for-integer-values/305080/2 "2022-05-18T16:06:19Z")

</div>

Hi!  
I read once that highlight is not applied to numeric types.  
Anyway, you can create a sub field as keyword and test.

---

<div class="post-metadata">

**Author:** ![Pyppe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pyppe/32/3531_2.png) [@Pyppe](https://discuss.elastic.co/u/Pyppe)\
**Post date:** [May 19, 2022, 7:00am UTC](https://discuss.elastic.co/t/show-highlights-for-matched-terms-query-for-integer-values/305080/3 "2022-05-19T07:00:31Z")

</div>

You seem to be right. If the number was `keyword` instead of `integer` we are starting to see them highlights. Thanks for the tip!

---

<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:** [June 16, 2022, 7:00am UTC](https://discuss.elastic.co/t/show-highlights-for-matched-terms-query-for-integer-values/305080/4 "2022-06-16T07:00:38Z")

</div>

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