从被索引中排除财产
我创建了下面的对象,它将映射到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; }
在NEST 2.0中,ElasticPropertyAttribute由每个类型属性(StringAttribute,DateAttribute …)替换。 我使用Ignore参数来排除属性。
字符串的例子:
上述就是C#学习教程:从被索引中排除财产分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!
[String(Ignore = true)] public string Id {get;set;}
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/cdevelopment/956672.html