Skip to content

SearchResponse.Documents throws null reference exception on successful callΒ #8340

@stromblom

Description

@stromblom

Elastic.Clients.Elasticsearch version:
8.15.5

Description of the problem including expected versus actual behavior:
SearchResponse.Documents throws a null ref exception because HitsMetadata is null (and/or possibly HitsMetadata.Hits).

Stacktrace:
at Elastic.Clients.Elasticsearch.SearchResponse`1.get_Documents() in /_/src/Elastic.Clients.Elasticsearch.Shared/Api/SearchResponse.cs:line 21

Expected behavior
Should not throw an exception. HitsMetadata/Hits being null should be handled gracefully.
The Documents property and also Hits property should handle HitsMetadata being null and also declare correct nullability.

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