嗨,我是升级到弹性2.x使用nest与c#。我过去经常使用省略规范=true作为属性的属性,但是对于新的嵌套,我无法找到等价的属性。它在哪里?
发布于 2016-04-04 18:39:17
在NEST 2.x中,当前不能使用基于属性的映射来设置Norms
(属性不是原始类型,而是INorms
)。
但是,您可以使用fluent映射,并与基于属性的映射混合使用。下面是一个在创建索引时定义映射的示例(您也可以使用Put映射API指定映射)
var descriptor = new CreateIndexDescriptor("myindex")
.Mappings(ms => ms
.Map<Company>(m => m
// infer mappings based on POCO property types and take into
// account attribute mappings
.AutoMap()
// override certain inferred or attribute based mappings
// from Automapping
.Properties(ps => ps
.String(s => s
.Name(c => c.Name)
// omit norms equivalent in Elasticsearch >= 2.0
.Norms(n => n
.Enabled(false)
)
)
)
)
);
https://stackoverflow.com/questions/36413192
复制相似问题