NEST 2.0 和 ElasticSearch 2 的重大变化

Breaking changes in NEST 2.0 and ElasticSearch 2

我有一个使用 NEST 1.0 和 ElasticSearch 1.0 的 WebAPI C# 项目

现在我转移到 NEST 2.0 和 ElasticSearch 2.0,它不再编译了

ElasticType 已被弃用 ElasticsearchType,没关系

但是,我的 POCO 有很多属性:

[ElasticProperty(Store = false, Index = FieldIndexOption.NotAnalyzed)]

我应该使用新的 NEST 2.0 约定重写

我该怎么做?

ElasticPropertyAttribute has been replaced with more specific attributes in NEST 2.x such as StringAttribute, DateAttribute, etc. 以反映每个不同字段类型映射上可用的属性。

Documentation is available for NEST 2.x on the Elastic clients documentation site