0

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?

1 Answer 1

1

You can change the default field name inference of using camel casing to instead use snake casing through DefaultFieldNameInferrer(Func<string, string>) on ConnectionSettings

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.