im using elasticsearch within a C# project using the NEST API. i want to show the searched terms as highlights in the results page but dont know how i handle the display of them. All the docs tell me how to set up the highlight feature in the search query but i cannot find any help on how i make these highlights appear on the page of results...
my query is as follows
result = client.Search(s => s
a.Match(m => m.OnField("_all").Query(m_strSearchQuery)) .From(intFrom) .Size(intSize) .Highlight(h => h .PreTags("<b style='color:orange'>") .PostTags("</b>") .OnFields(f => f .OnField(e => e.Title) .OnField(e => e.Content) ) ) );
Then i set my results to a variable that is the data for my repeater
var documents = result.Hits.Select(h => h.Source);
this.rptSearch.DataSource = documents;
this.rptSearch.Visible = true;
i dont see any of the terms highlighted in my results nor do i see the terms wrapped in the highlight tags...
i did notice on debug my results have a hits and a highlights array though the highlights value doesnt seem to show the complete text returned as i see in the hits.source...
anyone help on this?