【发布时间】:2015-03-27 20:00:31
【问题描述】:
我们正在研究 ElasticSearch (Nest),但遇到了问题。 在我们的应用程序中,我们只想为我们的对象使用接口。在这些接口中,我希望能够设置要索引的属性和不索引的属性。
public interface ISomething {
string Name {get;set;}
int Id {get;set;}
}
public class Something: ISomething {
public string Name { get;set; }
public int Id {get;set;}
// This property should not be visible
public string VerySecretCode {get;set}
}
当我们通过创建一个新的 ElasticClient() 来索引一个接口时,该对象的所有属性都被放入 json 中。是否可以告诉 ElasticClient 我们只希望显示接口公开的属性?
希望任何人都可以提供帮助。
【问题讨论】:
标签: c# interface elasticsearch nest