title: Painless: Get time difference
body: <p>I am very new to Painless. I want to write a simple script to get the time difference between @timestamp and T1 in milliseconds. </p>
  
  <p>I have tried using the doc['somefield'].value and doc['somefield'].date.millis and I am able to access <strong>@timestamp</strong> but not <strong>T1</strong>. </p>
  
  <p>Any help will be highly appreciated! I have posted the sample data source below: </p>
  
  <pre><code>{
    "_source": {
      "@timestamp": "2018-11-06T00:20:08.802Z",
       "fields": {
        "T1": "2018-11-06T00:20:07.862Z",
      }
    }
  </code></pre>