我需要在NEST(Elastic Search .NET客户端)
下面得到结果"detailVal": {
"name": "detailVal",
"type": "multi_field",
"fields": {
"detailVal": {
"type": "string"
},
"untouched": { // <== FOCUS 2
"type": "string",
"index": "not_analyzed",
"omit_norms": true,
"include_in_all": false,
"index_options": "docs" // <== FOCUS 1
}
}
}
到目前为止我已经完成了
[ElasticProperty(OmitNorms = true, Index = FieldIndexOption.not_analyzed, IncludeInAll = false, AddSortField = true)]
public string DetailVal { get; set; }
让我
"detailVal": {
"name": "detailVal",
"type": "multi_field",
"fields": {
"detailVal": {
"type": "string",
"index": "not_analyzed",
"omit_norms": true,
"include_in_all": false
},
"sort": { // <== FOCUS 2
"type": "string",
"index": "not_analyzed"
}
}
}
所以,任何想法如何
答案 0 :(得分:0)
基于属性的映射只能让你到目前为止。如果您只需要更改名称和设置简单属性就足够了。
推荐的方法是使用client.MapFluent()
有关如何设置index_options
了解如何创建自己的多字段映射。
您甚至可以将两种方法结合起来:
client.MapFluent<MyType>(m=>m
.MapFromAttributes()
//Map what you can't with attributes here
);
client.Map()
和client.MapFromAttributes()
很可能会在某个时候删除。