The value returned from doc['date'].value is a string value, the call to milis on it makes no sense. I am surprised Painless doesn't throw an exception there.
As to the second part of your question - we have runtime fields on Elasticsearch side, which are not tied to Kibana. This way you can create fields on read time, and access them from the console.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.