Not able to map Fields in NestedModel in Nest Search API

Hello,

i am facing issue while getting data from elasticsearch. i am using NEST client version 7.3.

i have my data stored in elasticsearch in following format:

{
 "_index": "custom-index-dev",
 "_type": "logevent",
 "_id": "VJcPBm0BVa5zJPTZuwbI",
 "_version": 1,
 "_score": 0,
 "_source": {
   "@timestamp": "2019-09-06T15:42:35.4110845+05:30",
   "level": "Information",
   "messageTemplate": "{HostingRequestStartingLog:l}",
   "message": "Request starting HTTP/1.1 POST http://localhost:5050/req/negotiate  0",
   "fields": {
               "Protocol": "HTTP/1.1",
               "Method": "POST",
               "Scheme": "http",
               "Host": "localhost:5050",
               "EventId": {
                            "Id": 1
                           },
               "RequestId": "0HLPIMAUEFD65:00000001",
               "RequestPath": "/req/negotiate",
               "ConnectionId": "0HLPIMAUEFD65",
               "Application": "Test"
   },
   "renderings": {
     "HostingRequestStartingLog": [
       {
         "Format": "l",
         "Rendering": "Request starting HTTP/1.1 POST http://localhost:5050/req/negotiate  0"
       }
     ]
   }
 },
 "fields": {
   "@timestamp": [
     "2019-09-06T10:12:35.411Z"
   ]
 }
}

And i am accessing the same data in .Net Core using NEST client as below

       var node = new Uri("http://localhost:9200");
        var settings = new ConnectionSettings(node);
        settings.DefaultIndex("custom-index-dev");
        var client = new ElasticClient(settings);

        var searchResponse = await client.SearchAsync<SearchResponse>(s => s
             .From(0)
             .Size(50)
         );

And "SearchResponse" Model is a nested model which has Fields model init.

    public class SearchResponse
    {
        public string Level { get; set; }
        public DateTime Time { get; set; }
        public string MessageTemplate { get; set; }
        public Fields Fields { get; set; }
    }

public class Fields
    {
        public EventId EventId { get; set; }
        public string Host { get; set; }
        public string TransportConnectionId { get; set; }
        public string RequestId { get; set; }
        public string RequestPath { get; set; }        
        public string ConnectionId { get; set; }
        public string Application { get; set; }
    }

public class EventId
    {
        public int Id { get; set; }
    }

But i am not able to get fields data int my inner model. Though i am able to get data in "SearchResponse" model but not in "Fields" Model init.

Please suggest..

Thanks in anticipation

NEST 7.x expects the case of fields in JSON to match exactly the case in the client configuration; by default, the client expects camel cased field names, but this can be changed with

var settings = new ConnectionSettings()
    // example: upper case all field names
    .DefaultFieldNameInferrer(f => f.toUpperInvariant());

This is a global change however, and you have mixed casing in your documents, some camel cased and some pascal cased. In this scenario, you can explicitly map property names using DataMemberAttribibute or PropertyNameAttribute

public class Fields
    {
        [DataMember(Name = nameof(EventId))]
        public EventId EventId { get; set; }
        [DataMember(Name = nameof(Host))]
        public string Host { get; set; }
        [DataMember(Name = nameof(TransportConnectionId))]
        public string TransportConnectionId { get; set; }
        [DataMember(Name = nameof(RequestId))]
        public string RequestId { get; set; }
        [DataMember(Name = nameof(RequestPath))]
        public string RequestPath { get; set; }
        [DataMember(Name = nameof(ConnectionId))]        
        public string ConnectionId { get; set; }
        [DataMember(Name = nameof(Application))]
        public string Application { get; set; }
    }