【问题标题】:Modify serializersettings for Nest and Elastic Search修改 Nest 和 Elastic Search 的序列化程序设置
【发布时间】:2013-11-15 12:53:44
【问题描述】:

我正在尝试更改 Newtonsoft 在使用 Nest 序列化对象时处理自引用循环的方式。我正在使用 Newtonsoft.Json 4.5.11,我坚持使用那个版本,Nest 是 0.11.7.0 版本,我使用的代码 sn-p 是

var searchBoxUri = new Uri("Url");

var elasticSettings = new ConnectionSettings(searchBoxUri)
    .SetDefaultIndex("sample");

elasticSettings.SetJsonSerializerSettingsModifier(s => {
    s.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
});

var client = new ElasticClient(elasticSettings);

client.Index(currentPage);

使用此代码,我在堆栈跟踪中得到以下异常

[JsonSerializationException: Self referencing loop detected with type 'some type'.]

那么,为什么客户端不使用我配置的设置或者我在这里遗漏了什么?

【问题讨论】:

  • 这可能是一个错误,明天将进行调查。
  • @MartijnLaarman 你调查过这个问题吗?

标签: elasticsearch json.net nest


【解决方案1】:

这是 0.11.7.0 版本中的一个错误,经过一些重大重构以使序列化更精简。

另见https://github.com/Mpdreamz/NEST/pull/382

将在 0.11.8/0 中修复

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多