In this article, sample codes are shown using flutter/dart.
"recordtime":
{
"type": "date"
}
When adding data to an index in Elasticsearch, if you specify the data type of a particular field as “date”, Elasticsearch expects this field as a date/time string in ISO 8601 format.
Create a new date format using iso 8601 like this:

This formatted date information is added to the json message which sent when making a post request to elasticsearch.

Additionally, Elasticsearch accepts epoch time format in seconds. We can use epoch time information.
epoch time also known as unix time, is a concept in computer science. Time is measured as the number of seconds that have passed since January 1, 1970, at 00:00:00.
Elasticsearch stores dates as number in epoch format.
DateTime now = DateTime.now();
String formattedDateTime = now.millisecondsSinceEpoch.toString();
If the formattedDateTime information is sent in milliseconds in the json message, when this record is later wanted to be displayed, the seconds information is displayed in epoch format.
