# How to disable automatic field name camelcasing of specific property in Elasticsearch.NET/NEST?

**URL:** <https://discuss.elastic.co/t/how-to-disable-automatic-field-name-camelcasing-of-specific-property-in-elasticsearch-net-nest/160885>\
**Category:** Elasticsearch\
**Created:** [December 14, 2018, 10:50am UTC](https://discuss.elastic.co/t/how-to-disable-automatic-field-name-camelcasing-of-specific-property-in-elasticsearch-net-nest/160885 "2018-12-14T10:50:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnArete](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@JohnArete](https://discuss.elastic.co/u/JohnArete)\
**Post date:** [December 14, 2018, 10:50am UTC](https://discuss.elastic.co/t/how-to-disable-automatic-field-name-camelcasing-of-specific-property-in-elasticsearch-net-nest/160885/1 "2018-12-14T10:50:52Z")

</div>

NEST automatically camelcases all field names (as stated in the documentation [https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/field-inference.html#camel-casing](https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/field-inference.html#camel-casing)). There is also a way to define a connection-wide delegate (by using DefaultFieldNameInferrer) for customizing field naming. However, this setting is global for the whole connection.

Is there a way to customize naming only for specific (dynamically mapped) property/field?

I am mapping a dictionary into ElasticSearch and currently NEST camelcases all the keys of the dictionary which has huge side-effects for me. I would like to preserve the naming of dictionary keys so that the dictionary data would be stored without any modifications.

NOTE: This was working as intended in ElasticSearch 2 (dictionary keys were not camelcased when they were mapped to ES). We recently upgraded to ElasticSearch 6 and this new behavior broke our system.

Example:

```
public class Entity
{
    public string Name { get; set; }
    public Dictionary<string, string> Data { get; set; }
}

var entity = new Entity()
{
    Name = "Foo",
    Data = new Dictionary<string, string>()
    {
        { "First", "Data1" },
        { "Second", "Data2" }
    }
};

// .... Insert entity into ES ....

// Actual result (note lowercase f and s)
{
    "name": "Foo",
    "data": {
        "first": "Data1",
        "second": "Data2"
    }
}

// Desired result (note uppercae F and S). This is the way how ElasticSearch 2 worked.
{
    "name": "Foo",
    "data": {
        "First": "Data1",
        "Second": "Data2"
}
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 11, 2019, 10:50am UTC](https://discuss.elastic.co/t/how-to-disable-automatic-field-name-camelcasing-of-specific-property-in-elasticsearch-net-nest/160885/2 "2019-01-11T10:50:55Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
