【问题标题】:Elasticserach NEST Client doesn't bind _score nor _id in searchresultsElasticsearch NEST 客户端在搜索结果中不绑定 _score 和 _id
【发布时间】:2019-09-07 10:08:02
【问题描述】:

我正在使用 NEST 客户端在具有 .net 核心应用程序的弹性数据库中进行搜索。

除了_id_score 字段都未绑定之外,一切正常。

所有其他字段,例如时间戳已填满。

我也尝试使用 [Number (Name="_score")][Text(Name="_id")] 属性,但字段始终为空/默认值

我错过了什么?

 public sealed class ElasticMapping
    {
        [Date(Name = "@timestamp")]
        public DateTime Timestamp { get; set; }

        [PropertyName("_id")]
        public string ElasticId { get; set; }

        [PropertyName("_score")]
        public Nullable<double> Score { get; set; }
    }

【问题讨论】:

    标签: .net elasticsearch .net-core nest


    【解决方案1】:

    这些字段不需要存在于您的文档中,它们是在弹性返回结果时被添加到命中的元文件。您可以设置断点并检查返回的结果,查看 hits 属性。

    【讨论】:

      猜你喜欢
      • 2013-03-31
      • 2023-03-30
      • 2017-12-22
      • 2015-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多