I am using ElasticSearch and want to get highlighted field on the aggregated result of the search query.
I do not want to get results of search query, so I kept the size
to be 0
which only gives me aggregated results.
Now I want to apply highlighters on the aggregated results, but that is not working. I am using a term aggregator and a top-hits aggregator as the sub aggregator. In the ES docs they have mentioned top-hits aggregator supports highlighting.
My structure of query goes like this:
{
size:0,
query:{
.......
},
aggregation:{
name-of-agg:{
term:{
....
},
aggregation:{
name-of-sub-agg:{
top-hits:{
....
}
}
}
},
highlight:{
fields:{
fieldname:{
}
}
}
}
}