title: How to user long value as a `Date` type in Elasticsearch?
body: <p>I am using Elasticsearch 7.10.1. My document has a field <code>timestamp</code> whose value is long, e.g. <code>1624841520000</code>. I tried to change it to use <code>Date</code> type but failed:</p>
  <pre><code>PUT myindex/_mapping
  {
        &quot;properties&quot;: {
          &quot;timestamp&quot;: {
            &quot;type&quot;: &quot;date&quot; 
          }
        }
      
  }
  </code></pre>
  <p>The error response is:</p>
  <pre><code>{
    &quot;error&quot; : {
      &quot;root_cause&quot; : [
        {
          &quot;type&quot; : &quot;illegal_argument_exception&quot;,
          &quot;reason&quot; : &quot;mapper [timestamp] cannot be changed from type [long] to [date]&quot;
        }
      ],
      &quot;type&quot; : &quot;illegal_argument_exception&quot;,
      &quot;reason&quot; : &quot;mapper [timestamp] cannot be changed from type [long] to [date]&quot;
    },
    &quot;status&quot; : 400
  }
  
  </code></pre>
  <p>How can I use this field as <code>date</code>?</p>