You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the feature:
Current version doesn't allow to get deserialized documents from TopHitsAggregate aggregation object if they have different types. An attempt to use an object as a generic type leads to an exception. The only workaround I've found is to use Newtonsoft.Json.Linq.JObject type for getting hits and then cast hits using ToObject(targetType) method:
var doss = topHitsAgg.Hits<Newtonsoft.Json.Linq.JObject>()
.Select(hit =>
{
var type = GetType(hit.Type);
return hit.Source.ToObject(type);
});