Closed
Description
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);
});
Metadata
Metadata
Assignees
Labels
No labels