被编入索引中排除属性 [英] Exclude property from being indexed

查看:118
本文介绍了被编入索引中排除属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面将被映射到ElasticSearch类型的对象创建的。我想排除被索引的 UnivId 属性:

  [ ElasticType(名称=类型1)] 
公共类类型1
{
//被忽略
公共字符串UnivId {搞定;组; }

[ElasticProperty(NAME =ID)]
公众诠释标识{搞定;组; }

[ElasticProperty(NAME =descSearch)]
公共字符串descSearch {搞定;组; }
}


解决方案

您应该能够设置 ElasticProperty 属性的选择禁用值,如下所示:



<预类=郎-CS prettyprint-覆盖> [ElasticProperty(选择禁用= TRUE)]
公共字符串UnivId {搞定;组; }


I have created below object which will be mapped to ElasticSearch type. I would like to exclude the UnivId property from being indexed:

[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; }
}

解决方案

You should be able to set the OptOut value of the ElasticProperty attribute, like the following:

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

这篇关于被编入索引中排除属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆