Nest converts first letter of field to lowercase in query


(James) #1

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:

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":[]}}


(Russ Cam) #2

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.


(system) #3

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