# Nest converts first letter of field to lowercase in query

**URL:** <https://discuss.elastic.co/t/nest-converts-first-letter-of-field-to-lowercase-in-query/82942>\
**Category:** Elasticsearch\
**Created:** [April 19, 2017, 6:27pm UTC](https://discuss.elastic.co/t/nest-converts-first-letter-of-field-to-lowercase-in-query/82942 "2017-04-19T18:27:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![witchlightning](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/witchlightning/32/71962_2.png) [@witchlightning](https://discuss.elastic.co/u/witchlightning)\
**Post date:** [April 19, 2017, 6:27pm UTC](https://discuss.elastic.co/t/nest-converts-first-letter-of-field-to-lowercase-in-query/82942/1 "2017-04-19T18:27:44Z")

</div>

NEST converts the first letter of the field name to lowercase??? See the code below. Why does NEST translate "SceneText" into "sceneText"?

```
                var searchResponse = _EsClientDAL.Current.Search<DTO.RiAll>(s => s
                    .Query(q => q
                    .Match(m => m
                        .Field(f => f.SceneText)
                        .Query(queryString))
                ));

```

Valid NEST response built from a successful low level call on POST: /ri/RiAll/\_search

# Audit trail of this API call:

- [1] HealthyResponse: Node: [http://localhost:9200/](http://localhost:9200/) Took: 00:00:00.1293725

# Request:

{"query":{"match":{"sceneText":{"query":"hide"}}}}

# Response:

{"took":2,"timed\_out":false,"\_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":0,"max\_score":null,"hits":[]}}

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [April 19, 2017, 10:39pm UTC](https://discuss.elastic.co/t/nest-converts-first-letter-of-field-to-lowercase-in-query/82942/2 "2017-04-19T22:39:35Z")

</div>

This is not an issue but expected behaviour.

By default, NEST camel cases the property names on the POCO when serializing the POCO into a JSON document to send to Elasticsearch. You can change this behaviour by using the `.DefaultFieldNameInferrer(Func<string,string>)` method on `ConnectionSettings`. [Take a look at the documentation for more details.](https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/field-inference.html#camel-casing)

---

<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:** [May 17, 2017, 10:53pm UTC](https://discuss.elastic.co/t/nest-converts-first-letter-of-field-to-lowercase-in-query/82942/3 "2017-05-17T22:53:14Z")

</div>

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