Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request to publish JsonNetSerializer #8343

Open
deinman opened this issue Sep 12, 2024 · 1 comment
Open

Feature request to publish JsonNetSerializer #8343

deinman opened this issue Sep 12, 2024 · 1 comment
Labels
8.x Relates to 8.x client version Area: Helpers Category: Feature

Comments

@deinman
Copy link

deinman commented Sep 12, 2024

Is your feature request related to a problem? Please describe.

Using latest Elastic.Clients.Elasticsearch (8.15.6) and trying to serialize with the JsonNetSerializer doesn't work as indicated in the test code. You've got these great examples in the tests:

public void DefaultJsonNetSerializer()
{
var pool = new SingleNodePool(new Uri("http://localhost:9200"));
var connectionSettings =
new ElasticsearchClientSettings(pool, sourceSerializer: JsonNetSerializer.Default);
var client = new ElasticsearchClient(connectionSettings);
}
/**
* `JsonNetSerializer.Default` is just syntactic sugar for passing a delegate like
*/
public void DefaultJsonNetSerializerUnsugared()
{
var pool = new SingleNodePool(new Uri("http://localhost:9200"));
var connectionSettings = new ElasticsearchClientSettings(
pool,
sourceSerializer: (builtin, settings) => new JsonNetSerializer(builtin, settings));
var client = new ElasticsearchClient(connectionSettings);
}

But it looks like you're not shipping the updated JsonNetSerializer. The NEST 7.15 version is available in NuGet, but at some point there were updates made with Elastic.Clients.Elasticsearch.JsonNetSerializer that aren't exposed anywhere. And I can't work out a way to use the 7.15 version with the Elastic.Clients.ElasticSearch 8.15.* versions.

Describe the solution you'd like

Please publish the Elastic.Clients.Elasticsearch.JsonNetSerializer.

Describe alternatives you've considered

My alternative seems to be to fork the Elastic.Clients.Elasticsearch.JsonNetSerializer code and reference that internally, but that's a lot of extra overhead given your published test suite utilizes the Elastic.Clients.Elasticsearch.JsonNetSerializer code.

Additional context

I've setup a repo to demonstrate the issue here: https://github.com/deinman/demoissueelastic

@flobernd flobernd added 8.x Relates to 8.x client version Area: Helpers labels Sep 16, 2024
@flobernd
Copy link
Member

Hi @deinman,

bringing back the JsonNetSerializer is currently not on the roadmap. It's currently unreleased as we did not have the capacity to thoroughly test it with the new client.

The new Elasticsearch client and the underlaying Elastic.Transport library is highly customizable and should allow you to implement a custom Serializer that delegates all (de-)serialization to Json.NET.

To get you started:

ElasticsearchClientSettings has a constructor overload that accepts a SourceSerializerFactory lambda. This lambda should return a custom Elastic.Transport.Serializer implementation.

I'm keeping this issue open as a feature request, but I can't promise anything at the moment or even give an ETA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.x Relates to 8.x client version Area: Helpers Category: Feature
Projects
None yet
Development

No branches or pull requests

2 participants