这是我的 NEST2.0 POCO 声明:
[ElasticsearchType(Name = "MyDocument")]
public class MyDocument: DynamicResponse
{
[String(Store = false, Index = FieldIndexOption.NotAnalyzed)]
public string HistoryId{ get; set; }
[String(Store = false, Index = FieldIndexOption.NotAnalyzed)]
public string FileId { get; set; }
[Date(Store = false)]
public DateTime DateTime { get; set; }
}
这是它的映射:
elastic.Map<MyDocument>(m => m
.Index(indexName)
.AutoMap().AllField(a => a.Enabled(false))
.Dynamic()
.DynamicTemplates(dt => dt
.Add(t => t
.Name("pv_values_template")
.Match("ch_*")
.Mapping(m2 => m2
.Number(n => n
.Store(false)
.Index(NonStringIndexOption.NotAnalyzed)
.DocValues(true))))));
看起来该.Add()
方法不再存在(它在 NEST 1.0 中运行良好)