# Is there a way to show nested fields when showing highlight results?

**URL:** https://discuss.elastic.co/t/is-there-a-way-to-show-nested-fields-when-showing-highlight-results/293740
**Category:** Elasticsearch
**Created:** [January 7, 2022, 12:51pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-show-nested-fields-when-showing-highlight-results/293740 "2022-01-07T12:51:46Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![munkyu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/munkyu/32/73079_2.png) [@munkyu](https://discuss.elastic.co/u/munkyu)
#### Post date: [January 7, 2022, 12:51pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-show-nested-fields-when-showing-highlight-results/293740/1 "2022-01-07T12:51:46Z")

</div>

nested fields like below.

```auto
"comments" : [
            {
              "content" : "apple computer",
              "votes_count" : 1
            },
            {
              "content" : "apple computer is good",
              "votes_count" : 2
            }
          ]

```

In this case If I use es highlighter like below

```auto
"highlight": {
    "type": "plain",
    "fields": {
      "comments.content": {
        "highlight_query": {
          "match": {
            "comments.content": {
              "query": "apple"
            }
          }
        }
      }
    }
  }

```

will be return like below

```auto
...
"highlight" : {
  "comments.content" : [
      "<em>apple</em> computer",
     "<em>apple</em> computer is good"
   ]
 }

```

But what I want is including both comments.content and comments.votes\_count as a highlight result.

Is is possible in Elasticsearch?

---

<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: [February 4, 2022, 12:52pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-show-nested-fields-when-showing-highlight-results/293740/2 "2022-02-04T12:52:19Z")

</div>

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