Using elasticsearch, I'm trying to add my hit results into a list after they are returned, like this:
var lstModels = new SearchResult<mdl.Event>(); var searchResponse = Event.client.Search<mdl.Event>(s => s .Query(q => q .QueryString(qs => qs .Query(search.Text)) && q .DateRange(r => r .Field(f => f.CreatedTimeStamp) .GreaterThanOrEquals(search.From) .LessThanOrEquals(search.To)))); lstModels.AddItems(searchResponse.Hits);
However I am getting an error saying that my types are incompatible.
cannot convert from 'System.Collections.Generic.IReadOnlyCollection<Nest.IHit<Event>>' to 'System.Collections.Generic.IEnumerable<Event>'
Why are my hits returning as part of the Read Only Collection? Is there a way to change this so that they are usable?