WARNING: Version 5.x has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Using highlighting you can return the relevant parts of a field and using highlighted markers, indicate why a document matched
var result = this._client.Search<ElasticSearchProject>(s => s .From(0) .Size(10) .Query(q => q .QueryString(qs => qs .OnField(e => e.Content) .Query("null or null*") ) ) .Highlight(h => h .PreTags("<b>") .PostTags("</b>") .OnFields(f => f .OnField(e => e.Content) .PreTags("<em>") .PostTags("</em>") ) ) );
Please take note that this won’t alter the contents of the results
.Documents but the results will have a separate bucket
that contains each highlight result(s) for each hit on