How sort by date/time on Kibana Discover

Thanks; I'm calling a C# routine someone else wrote as a commonly used library by our middleware team. We basically stuff message in ElasticSearch rather than writing to file system. Other people here may know better how to search, but I'm still new.

I'm not sure how createdDate is being populated. So far I assumed it must be automatic, but I did notice that didn't have the underscore in front of it.

This is basically our code (I just omiitted the connection info and the try/catch):

             // using Eleasticsearch.Net; library 
             var shared = new ElasticClient(config);
             var index = new StringBuilder();
             // Make lower case, prefix with environment, and add datetime on end of index name. 
             index.Append(environment.ToLower());
             index.Append("-").Append(indexType).Append("-");
             index.Append(DateTime.Now.ToString("yyyy.MM.dd"));
           
             if (!shared.IndexExists(index.ToString().ToLower()).Exists)
             {
                 CreateIndexRequest request = new CreateIndexRequest(index.ToString().ToLower());
                 TypeMapping typeMapping = new TypeMapping();
                 typeMapping.DateDetection = false;
                 request.Mappings = new Mappings();
                 request.Mappings.Add("object", typeMapping);
                 shared.CreateIndex(request);
             }
             
             var result = shared.Index(message, idx => idx.Index(index.ToString().ToLower()));

You can see we are not specifying createdDate anywhere in there. So do you have any idea how it gets there?

I've got a few ideas on how we can improve what they do, but first I have to understand the basics.