Elasticsearch-net: .Source() did not seems to use the given SourceSerializer

Created on 20 Aug 2020  路  1Comment  路  Source: elastic/elasticsearch-net

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.

bug

Most helpful comment

Hi @lanwin

I can confirm this is a bug and have opened https://github.com/elastic/elasticsearch-net/pull/4979 to address

>All comments

Hi @lanwin

I can confirm this is a bug and have opened https://github.com/elastic/elasticsearch-net/pull/4979 to address

Was this page helpful?
0 / 5 - 0 ratings