# C# ElasticClient search - field name upper case issue

**URL:** <https://discuss.elastic.co/t/c-elasticclient-search-field-name-upper-case-issue/334903>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [June 1, 2023, 6:22am UTC](https://discuss.elastic.co/t/c-elasticclient-search-field-name-upper-case-issue/334903 "2023-06-01T06:22:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yujie\_S](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yujie_s/32/121714_2.png) [@Yujie\_S](https://discuss.elastic.co/u/Yujie_S)\
**Post date:** [June 1, 2023, 6:22am UTC](https://discuss.elastic.co/t/c-elasticclient-search-field-name-upper-case-issue/334903/1 "2023-06-01T06:22:40Z")

</div>

My record is like this:  
{  
"\_index": "cmmtest2",  
"_id": "q3\_WdIgBcz5F0I953TG_",  
"\_score": 1,  
"\_source": {  
"characteristic": "150 W8 Prof 0.1 J",  
"actual": 0.019991,  
"nominal": 0,  
"partno": "2022\_7933 S2",  
"XBAR": "XX"  
}  
}

My code is:

```auto
        public class Record2
        {
            public string characteristic { get; set; }
            public float actual { get; set; }
            public float nominal { get; set; }
            public string partno { get; set; }
            public string XBAR { get; set; }
        }

        public static string Initial2()
        {
            var settings = new ConnectionSettings(new Uri("http://localhost:9200")).DefaultIndex("cmmtest2");
            settings.DisableDirectStreaming();
            var client = new ElasticClient(settings);
            var searchResponse = client.Search<Record2>(s=>s.Size(300));
            var record = searchResponse.Hits;
            return record.ToString();
}

```

I can get value from "Hits" if the field name is in lower case, but cannot get value in upper case like "XBAR".

In python or other tools, it doesn't matter. Does it have any solution?

---

<div class="post-metadata">

**Author:** ![stevejgordon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stevejgordon/32/80912_2.png) [@stevejgordon](https://discuss.elastic.co/u/stevejgordon)\
**Post date:** [June 5, 2023, 9:28am UTC](https://discuss.elastic.co/t/c-elasticclient-search-field-name-upper-case-issue/334903/2 "2023-06-05T09:28:09Z")

</div>

Hi, @Yujie_S.

The default behaviour when serialising document type properties is case-sensitive and applies camelCasing. You can control this globally or on a per-property basis.

In your case, you should look at introducing the `PropertyName` attribute as per this [documentation](https://www.elastic.co/guide/en/elasticsearch/client/net-api/7.17/modelling-documents-with-types.html#propertyname-attribute). That documentation also provides full guidance on field name inference.

---

<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:** [July 3, 2023, 9:28am UTC](https://discuss.elastic.co/t/c-elasticclient-search-field-name-upper-case-issue/334903/3 "2023-07-03T09:28:26Z")

</div>

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