# Highlighting is not working on my search results

**URL:** <https://discuss.elastic.co/t/highlighting-is-not-working-on-my-search-results/25712>\
**Category:** Elasticsearch\
**Created:** [July 16, 2015, 10:04am UTC](https://discuss.elastic.co/t/highlighting-is-not-working-on-my-search-results/25712 "2015-07-16T10:04:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anusha6](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@anusha6](https://discuss.elastic.co/u/anusha6)\
**Post date:** [July 16, 2015, 10:04am UTC](https://discuss.elastic.co/t/highlighting-is-not-working-on-my-search-results/25712/1 "2015-07-16T10:04:41Z")

</div>

Hi,

Am using the following query for to highlight my search data..

GET /ymme/ymme\_type/\_search  
{  
"query": {  
"bool": {  
"must": [  
{  
"match": {  
"\_all":  
{  
"query": "2012 aston",  
"operator": "and"  
}  
}  
}  
]  
}  
},  
"highlight": {  
"fields": {  
"Year":{}  
}  
}  
}

The o/p am getting for this in sense plugin as:

"\_score": 8.155715,  
"\_source": {  
"MakeCode": "101",  
"Year": "2012",  
"Model": "DBS",  
"EngineCode": "6",  
"YearCode": "2012",  
"ShortYear": "12",  
"Engine": "12-5935 6.0L",  
"ModelCode": "6",  
"Make": "ASTON MARTIN"  
},  
"highlight": {  
"Year": [  
"_2012_"  
]  
}  
}  
....................  
..............  
..........  
And the relevant Java API am using:

```
BoolQueryBuilder builder= boolQuery();
		builder.must(QueryBuilders.matchQuery("_all", term).operator(MatchQueryBuilder.Operator.AND).fuzziness(4).prefixLength(4));
		
		SearchRequestBuilder srb = client.prepareSearch().setTimeout(timeValue).setQuery(builder).addHighlightedField("Year");

		setParameters(index, type, size, srb);

		SearchResponse response = srb.execute().actionGet();

		hits=response.getHits();

```

But in UI my response data is not highlighted, may I know the reason.. Do I need to write the code in any other way to highlight my data which is displaying in UI????????

---

<div class="post-metadata">

**Author:** ![anusha6](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@anusha6](https://discuss.elastic.co/u/anusha6)\
**Post date:** [July 16, 2015, 10:24am UTC](https://discuss.elastic.co/t/highlighting-is-not-working-on-my-search-results/25712/2 "2015-07-16T10:24:12Z")

</div>

And when am using the following query.......

GET /ymme/ymme\_type/\_search  
{  
"query": {  
"bool": {  
"must": [  
{  
"match": {  
"\_all":  
{  
"query": "2012 aston martin",  
"operator": "and"  
}  
}  
}  
]  
}  
},  
"highlight": {  
"fields": {  
"Year":{},  
"Make":{}

```
      }
  }
  }

```

Am getting response with only one highlight field "Year",

{  
"\_index": "ymme",  
"\_type": "ymme\_type",  
"\_id": "AU4Fz0hhSl0tkDoQ8lSM",  
"\_score": 9.607379,  
"\_source": {  
"MakeCode": "101",  
"Year": "2012",  
"Model": "RAPIDE",  
"EngineCode": "6",  
"YearCode": "2012",  
"ShortYear": "12",  
"Engine": "12-5935 6.0L",  
"ModelCode": "14",  
"Make": "ASTON MARTIN"  
},  
"highlight": {  
"Year": [  
"_2012_"  
]  
}  
},  
{  
"\_index": "ymme",  
"\_type": "ymme\_type",  
"_id": "AU4Fz2M-Sl0tkDoQ8oq_",  
"\_score": 9.607379,  
"\_source": {  
"MakeCode": "101",  
"Year": "2012",  
"Model": "VIRAGE",  
"EngineCode": "6",  
"YearCode": "2012",  
"ShortYear": "12",  
"Engine": "12-5935 6.0L",  
"ModelCode": "12",  
"Make": "ASTON MARTIN"  
},  
"highlight": {  
"Year": [  
"_2012_"  
]  
}  
}

May I know how can I get all the highlight fields???

---

<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:** [July 6, 2017, 12:01am UTC](https://discuss.elastic.co/t/highlighting-is-not-working-on-my-search-results/25712/3 "2017-07-06T00:01:03Z")

</div>


