我创建了以下对象,它将映射到 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; }
}
最佳答案
您应该能够设置 ElasticProperty
属性的 OptOut
值,如下所示:
[ElasticProperty(OptOut = true)]
public string UnivId { get; set; }
关于c# - 从索引中排除属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23063839/