【发布时间】:2017-07-24 16:22:52
【问题描述】:
ElasticSearch 建议在字段名称中使用下划线。 我正在使用 Nest 客户端,我有以下类型:
public class Employee
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
Nest 客户端提供了一种称为自动映射的功能,可以从 POCO 的属性中自动推断出正确的映射。如果使用此功能,我将得到:
"employee": {
"properties": {
"firstName": {
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
},
"type": "text"
},
"lastName": {
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
},
"type": "text"
},
}
}
但字段不符合命名约定。使用属性定义自己的映射还有另一个功能。但我不想为每个字段手动指定它。那么有没有可能配置客户端默认使用下划线来组合单词呢?
【问题讨论】:
标签: elasticsearch nest