FWIW - if you want these values to be available in kibana just use SimpleDateFormat like so:
Date date = new Date(System.currentTimeMillis());
// Conversion
SimpleDateFormat sdf;
sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
String stamp = sdf.format(date);
Then add this to your HashMap as '@timestamp':
// write to elastic
RestHighLevelClient client = getClient();
Map<String, Object> mapObject = new HashMap();
mapObject.put("type", "consumer_test");
mapObject.put("test.group", group);
mapObject.put("test.topic", topic);
mapObject.put("test.sum", sumLag);
mapObject.put("@timestamp", stamp);
IndexRequest indexRequest = new IndexRequest(index).source(mapObject);
try {
IndexResponse indexResponse = client.index(indexRequest, RequestOptions.DEFAULT);
client.close();
} catch(Exception e) {
LOGGER.error("exception from indexing request", e);
return false;
}