Skip to content

.Source() did not seems to use the given SourceSerializer #4970

@lanwin

Description

@lanwin

NEST/Elasticsearch.Net version:
7.9.0

Elasticsearch version:
7.6.2

Description of the problem including expected versus actual behavior:
We are using the JsonNetSerializer. One of our types should get a list of sub types with an abstract base class ( Event -> EventA ). For this case I have created a custom JsonConverter witch create the subtypes based on an type property. This works well with plain Json.Net and also with client.Get(). But on some places we use client.Source() and there is it where it stops working and we get:

Elasticsearch.Net.UnexpectedElasticsearchClientException: 'generated serializer for Event does not support deserialize.'

So it tries to deserialize the abstract base class Event instead of using the JsonConvert. I can see that the JsonConverter is not called at any time with .Source. So my guess is that .Source did not use the client.SourceSerializer. Maybe that is by design, but I did not find anything useful on the documentation.

Steps to reproduce:
Not yet

Expected behavior
.Source() also should use the SourceSerializer and so my case should work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions