title: spark write timestamp as long in elasticsearch
body: <p>im reading data from jdbc source and writing it directly into elastic search index.
  when I queried the data in ES I saw that all timestamp fields in my dataframe transformed to long</p>
  
  <p>see my code below</p>
  
  <pre><code> val appName="ExractToolEngine"
   val master = "local[2]"
   val conf = new SparkConf().setAppName(appName).setMaster(master)
   conf.set("es.write.operation", "index")
   conf.set("es.mapping.id", "user_id")
   conf.set("index.mapper.dynamic", "true")
   conf.set("es.mapping.rich.date", "true")
  
    def main(args: Array[String]): Unit = {
      val sc = new SparkContext(conf)
      val sqlContext = new SQLContext(sc)
      import sqlContext.implicits._
  
      val srcData = sqlContext.read.format("jdbc").
        options(Map("driver"-&gt;"com.jdbc.Driver",
        "url" -&gt; "jdbc...",
        "dbtable"-&gt; "tbl",
        "partitionColumn"-&gt; "user_id",
        "lowerBound"-&gt; "1",
        "upperBound"-&gt; "1000000",
        "numPartitions"-&gt; "50"
        )
  ).load()
      srcData.filter("user_id&gt;=1 and user_id&lt;=1000000").saveToEs("test_users/sm_1")
  </code></pre>
  
  <p>}</p>
  
  <p>when I run <code>srcData.printSchema()</code></p>
  
  <p>I get:</p>
  
  <pre><code>|-- dwh_insert_ts: timestamp (nullable = true)
  |-- dwh_update_ts: timestamp (nullable = true)
  </code></pre>
  
  <p>when I query the index mapping  on <a href="http://localhost:9200/test_users/_mapping/sm_1" rel="nofollow">http://localhost:9200/test_users/_mapping/sm_1</a></p>
  
  <p>I see </p>
  
  <pre><code>"properties": {
  "dwh_insert_ts": {
  "type": "long"
  },
  "dwh_update_ts": {
  "type": "long"
  },
  </code></pre>
  
  <p>is there a away to force elasticsearch to stay with timestamp and do the conversion?</p>