Reputation: 21
ElasticSearch recommends to use underscores for field names. I'm using Nest client and I have the following type:
public class Employee
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
Nest client offers a feature called auto mapping that can automatically infer the correct mappings from the properties of the POCO. If use this feature I will get:
"employee": {
"properties": {
"firstName": {
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
},
"type": "text"
},
"lastName": {
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
},
"type": "text"
},
}
}
But fields does not conform naming convention. There is another feature for defining own mappings using attributes. But I don't want to specify it manually for each field. So is there a possibility to configure client to use underscores for combining words by default?
Upvotes: 0
Views: 527
Reputation: 125488
You can change the default field name inference of using camel casing to instead use snake casing through DefaultFieldNameInferrer(Func<string, string>)
on ConnectionSettings
Upvotes: 1