【发布时间】:2017-05-11 17:49:16
【问题描述】:
我曾经在 Elastic Search 2.0 中枚举类型的类属性上具有 String 属性,以便将枚举值存储为字符串而不是整数:
public enum PaperType
{
A4 = 0,
A3 = 1
}
以及在 ElasticSearch 中作为文档存储的类
[ElasticsearchType(Name = "Paper")]
public class Paper
{
[String(Store = false, Index = FieldIndexOption.Analyzed)]
public string Name { get; set; }
[String(Store = false, Index = FieldIndexOption.Analyzed)]
public PaperType Type { get; set; }
}
所以 in Type 将被存储为 A3 或 A4 而不是 0 或 1。
在 ElasticSearch 5 中,这些属性发生了变化,
我怎样才能在 ElasticSearch 5 中实现相同的行为或什么属性以及它应该是什么?
谢谢
【问题讨论】:
标签: elasticsearch enums attributes nest