Nest 省略嵌套2中的规范

Nest 省略嵌套2中的规范,nest,Nest,嗨,我正在用c#的nest升级到elastic 2.x。 我曾经使用omit norms=true作为属性的属性,但是对于新的嵌套,我找不到等效的属性。 它在哪里?在NEST 2.x中,当前无法使用基于属性的映射进行设置(该属性不是基元类型,而是一个INorms) 但是,您可以使用,并与基于属性的映射混合使用。下面是一个在创建索引时定义映射的示例(您也可以使用Put映射API指定映射) var descriptor=new CreateIndexDescriptor(“myindex”) .Ma

嗨,我正在用c#的nest升级到elastic 2.x。 我曾经使用omit norms=true作为属性的属性,但是对于新的嵌套,我找不到等效的属性。 它在哪里?

在NEST 2.x中,当前无法使用基于属性的映射进行设置(该属性不是基元类型,而是一个
INorms

但是,您可以使用,并与基于属性的映射混合使用。下面是一个在创建索引时定义映射的示例(您也可以使用Put映射API指定映射)

var descriptor=new CreateIndexDescriptor(“myindex”)
.Mappings(ms=>ms
.Map(m=>m
//根据POCO属性类型推断映射并考虑
//帐户属性映射
.AutoMap()
//覆盖某些推断的或基于属性的映射
//从自动映射
.Properties(ps=>ps
.String(s=>s
.Name(c=>c.Name)
//省略Elasticsearch>=2.0中的等效规范
.Norms(n=>n
.已启用(错误)
)
)
)
)
);
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)
                    )
                )
            )
        )
    );