Search code examples
nestelasticsearch-net

Set the RequestResponseSerializer in ElasticClient


We've seen a resurrection of this issue in a recent update of Elasticsearch (https://github.com/elastic/elasticsearch-net/issues/1937).

We set the SourceSerializer when creating the Client connection but that doesn't seem to help.

Debugging in, I see that RequestResponseSerializer defaults to Nest.InternalSerializer. This JSON serializer has the DateParseHandling field set to DateTime when we want DateTimeOffset. I suspect that this may be the cause of my problem.

Is there a way to set RequestResponseSerializer to verify my theory?


ADDITION: I was able to verify my theory above by altering the NEST code directly. I edited the InternalSerializer::CreateSettings() method to include DateParseHandling = DateParseHandling.DateTimeOffset and that solved the issue.

Now how to set/modify this value for RequestResponseSerializer without modifying NEST code directly...


Solution

  • Turns out my issue was the same as https://github.com/elastic/elasticsearch-net/issues/3164 and seemed to be fixed in v6.2.0 (https://github.com/elastic/elasticsearch-net/pull/3278).

    I was running v6.1.0

    Upgraded my version to v6.3.1 and all looks well.