Skip to content

Support different response type than the input type #7792

Closed
@JuganD

Description

@JuganD

Is your feature request related to a problem? Please describe.
In the ES 7 NEST Client it was possible to send a request using SearchAsync, which has a Query with a generic type of a base class and then cast it to a child class. Currently, sending such request using SearchRequestDescriptor<TDocument> parameter, outputs already casted elements to the particular TDocument type.

Describe the solution you'd like
It would be nice to have an overload of SearchAsync, which accepts another generic type than the provided input type and casts the response results to it.

Describe alternatives you've considered
Not sure if there is an alternative currently, I considered changing the generic types of the descriptors to the requested ones, but with huge codebase with many document types, the code reusability goes down considerably.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions