一尘不染

从索引中排除属性

elasticsearch

我已经创建了下面的对象,该对象将被映射到ElasticSearch类型。我想UnivId从索引中排除该属性:

[ElasticType(Name = "Type1")]
public class Type1
{
    // To be ignored
    public string UnivId { get; set; }

    [ElasticProperty(Name="Id")]
    public int Id { get; set; }

    [ElasticProperty(Name = "descSearch")]
    public string descSearch { get; set; }
}

阅读 236

收藏
2020-06-22

共1个答案

一尘不染

您应该能够设置属性的OptOut值,ElasticProperty如下所示:

 [ElasticProperty(OptOut = true)]
 public string UnivId { get; set; }
2020-06-22