# Missing required property 'Highlight.fields'

**URL:** <https://discuss.elastic.co/t/missing-required-property-highlight-fields/322294>\
**Category:** Elasticsearch\
**Tags:** kql-kibana-query-language\
**Created:** [January 2, 2023, 9:27am UTC](https://discuss.elastic.co/t/missing-required-property-highlight-fields/322294 "2023-01-02T09:27:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ali5](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ali5/32/113900_2.png) [@Ali5](https://discuss.elastic.co/u/Ali5)\
**Post date:** [January 2, 2023, 9:27am UTC](https://discuss.elastic.co/t/missing-required-property-highlight-fields/322294/1 "2023-01-02T09:27:35Z")

</div>

i am using elasticsearch bool querry with springboot application my querry is as follow:

```auto
public List<feed> search(String id) throws IOException {
       
           Query bodyTermQuery = TermQuery.of(tq -> tq.field("body").value(id))._toQuery();
           Query titleTermQuery = TermQuery.of(tq -> tq.field("title").value(id))._toQuery();

           Query matchQuery = MatchQuery.of(mq -> mq.field("comment.c_text").query(id))._toQuery();

           Query nestedQuery = NestedQuery.of(nq -> nq.path("comment").query(matchQuery)
                           .innerHits(ih -> ih.highlight(h -> h.requireFieldMatch(true))))._toQuery();

           SearchResponse<feed> searchResponse = elasticsearchClient.search(
                           s -> s.index("feeds").query(q -> q.bool(b -> b.should(nestedQuery, titleTermQuery, bodyTermQuery))),
                           feed.class);
         
           
           List<Hit<feed>> hits = searchResponse.hits().hits();
           List<feed> feeds = new ArrayList<>();
           feed f=null;
           for(Hit object : hits){
        	   f = (feed) object.source();
        	   System.out.println("Feed : "+ f.getComment().get(1).getC_text());
               feeds.add(f); }
           
           return feeds;    
           }

```

i dont why it is not working in my springboot application i have used kibana to get my desired output and working fine but in my springboot application it didnt give my out the querry i used on kibana is as follow :

```auto

GET feeds/_search
{
  "query": {
    "bool": {
      "should": [
        {
          "nested": {
            "path": "comment",
            "query": { 
              "match": {
                "comment.c_text": "hey"
              }
            },"inner_hits": {
              "highlight": {
                "require_field_match": "true"
                
              }
            }
          }
        },
        {
          "term": {
            "title": {
              "value": "hey"
            }
          }
        },
        {
          "term": {
            "body": {
              "value": "hey"
            }
          }
        }
      ]
    }
  }
}

```

detail error

```auto
023-01-02 13:08:12.792[0;39m [31mERROR[0;39m [35m5008[0;39m [2m---[0;39m [2m[nio-8080-exec-3][0;39m [36mo.a.c.c.C.[.[.[/].[dispatcherServlet] [0;39m [2m:[0;39m Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is co.elastic.clients.util.MissingRequiredPropertyException: Missing required property 'Highlight.fields'] with root cause

```

**Can Anyone help me learn more about highlights.fields how can i study it how can i use it because i want to mapp the inner hits in my response**

---

<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:** [January 30, 2023, 9:27am UTC](https://discuss.elastic.co/t/missing-required-property-highlight-fields/322294/2 "2023-01-30T09:27:41Z")

</div>

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