elasticsearch-net icon indicating copy to clipboard operation
elasticsearch-net copied to clipboard

Request to reintroduce .Documents<T>() method for InnerHits for automatic document conversion

Open gise88 opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe. && Describe the solution you'd like I'd like to request the reintroduction of the .Documents<T>() method, which was available in the 6.x branch of the library (I'm uncertain about its presence in version 7.*). This method was highly valuable for automatically converting every document in a specific type.

Describe alternatives you've considered I haven't found any already prepared alternatives, but I'm open to any suggestions!

Additional context In the 6.x branch of the library, the .Documents<T>() method was located in the src\Nest\Search\Search\Hits\InnerHitsMetaData.cs file and was defined as follows:

public IEnumerable<T> Documents<T>() where T : class
{
    if (Hits == null || !Hits.HasAny())
        return Enumerable.Empty<T>();

    return Hits.Select(hit => hit.Source.As<T>()).ToList();
}

gise88 avatar Sep 06 '23 17:09 gise88