public static FindResults <T> ToFindResults <T>(this ISearchResponse <T> response, int?limit = null) where T : class, new() { var docs = response.Hits.Take(limit ?? Int32.MaxValue).ToFindHits().ToList(); var data = response.ScrollId != null ? new DataDictionary { { ElasticDataKeys.ScrollId, response.ScrollId } } : null; return(new FindResults <T>(docs, response.Total, response.ToAggregationResult(), null, data)); }