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????????