# Custom serialization with 7.0.0 Elasticsearch NEST

**URL:** <https://discuss.elastic.co/t/custom-serialization-with-7-0-0-elasticsearch-nest/188535>\
**Category:** Elasticsearch\
**Created:** [July 2, 2019, 2:51pm UTC](https://discuss.elastic.co/t/custom-serialization-with-7-0-0-elasticsearch-nest/188535 "2019-07-02T14:51:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Slade](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@Slade](https://discuss.elastic.co/u/Slade)\
**Post date:** [July 2, 2019, 2:51pm UTC](https://discuss.elastic.co/t/custom-serialization-with-7-0-0-elasticsearch-nest/188535/1 "2019-07-02T14:51:56Z")

</div>

The [documentation for custom-serialization in 7.x (current)](https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/custom-serialization.html#custom-serialization) doesn't seem to be updated as it doesn't seem to mention anything regarding the switch to Utf8Json in the 7.x version. It also talks about the current version as if it's 6.x. Was the Utf8Json change completely internal and alters nothing with how one should customise serialization?

I'm asking as the serializer we use which is based on the base class `ConnectionSettingsAwareSerializerBase` from `NEST.JsonNetSerializer` is behaving weirdly. When used any type of number is not formatted and any objects container a number are null. All the serializer does it override the `CreateJsonConverters()` and adds some user type converters.

I didn't include an example to reproduce the missing numbers error as I figured I might as well wait for a reply before I write one.

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [July 2, 2019, 9:35pm UTC](https://discuss.elastic.co/t/custom-serialization-with-7-0-0-elasticsearch-nest/188535/2 "2019-07-02T21:35:36Z")

</div>

Thank you for raising the documentation about Serialization. It does need to be updated to reflect the move from [Json.NET](http://Json.NET) to Utf8Json

> [@Slade](#):
>
> Was the Utf8Json change completely internal and alters nothing with how one should customise serialization?

Custom serialization using Nest.JsonNetSerializer nuget package, or implementing your own source serializer should work the same in 7.x. Would you mind [opening an issue to discuss](https://github.com/elastic/elasticsearch-net/issues)?

---

<div class="post-metadata">

**Author:** ![Slade](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@Slade](https://discuss.elastic.co/u/Slade)\
**Post date:** [July 3, 2019, 2:07pm UTC](https://discuss.elastic.co/t/custom-serialization-with-7-0-0-elasticsearch-nest/188535/3 "2019-07-03T14:07:30Z")

</div>

I'll try to reproduce and create an issue when I do.  
Thanks.

This can be closed.

---

<div class="post-metadata">

**Author:** ![Slade](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@Slade](https://discuss.elastic.co/u/Slade)\
**Post date:** [July 4, 2019, 12:50pm UTC](https://discuss.elastic.co/t/custom-serialization-with-7-0-0-elasticsearch-nest/188535/4 "2019-07-04T12:50:13Z")

</div>

> [@forloop](#):
>
> Custom serialization using Nest.JsonNetSerializer nuget package, or implementing your own source serializer should work the same in 7.x. Would you mind [opening an issue to discuss](https://github.com/elastic/elasticsearch-net/issues)?

I can't seem to reproduce it in another app (can't share code where it's happening).  
Tracing the deserialization and seemingly random properties failed to be deserialized with the message `"Verbose Could not find member 'x' on a.b.c.d.e Path 'w.x', line 40, position 22."`

Other properties of the same type can be deserialized which is quite strange.  
Should I open an issue with just this information or how should I proceed?

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [July 5, 2019, 12:41am UTC](https://discuss.elastic.co/t/custom-serialization-with-7-0-0-elasticsearch-nest/188535/5 "2019-07-05T00:41:36Z")

</div>

Yes, please [open an issue](https://github.com/elastic/elasticsearch-net/issues) so we can discuss 👍

---

<div class="post-metadata">

**Author:** ![Slade](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@Slade](https://discuss.elastic.co/u/Slade)\
**Post date:** [July 8, 2019, 2:29pm UTC](https://discuss.elastic.co/t/custom-serialization-with-7-0-0-elasticsearch-nest/188535/6 "2019-07-08T14:29:06Z")

</div>

The issue was that after upgrading from 6.4.2 to 7.0.0 the way we were ignoring certain properties stopped working so fields which weren't supposed to be indexed were ([NEST 7 ConnectionSettings DefaultMappingFor doesn't support base class mapping anymore](https://discuss.elastic.co/t/nest-7-connectionsettings-defaultmappingfor-doesnt-support-base-class-mapping-anymore/188742/2)) .  
We use a custom serializer with converters for these types when reading from Elasticsearch and it failed to deserialize these fields which meant that all fields after the first instance of the type failed to be deserialized.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 5, 2019, 2:29pm UTC](https://discuss.elastic.co/t/custom-serialization-with-7-0-0-elasticsearch-nest/188535/7 "2019-08-05T14:29:15Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
