title: Visualising time difference between two fields in Elasticsearch and Kibana
body: <p>I'm trying to visualize the time difference (in hours) between two date fields.</p>
  
  <p>The fields are declared like this:</p>
  
  <pre><code> "fieldname": {
       "type": "date"
    },
  </code></pre>
  
  <p>The solution I found was:</p>
  
  <pre><code>,
    "script_fields" : {
      "timedifference" : {
        "script" : "doc['loading_startTime'].value - doc['startTime'].value"
      }
    }
  </code></pre>
  
  <p>The result I get is as follows:</p>
  
  <p><a href="https://i.stack.imgur.com/ZHK5w.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZHK5w.png" alt="enter image description here"></a></p>
  
  <p>I'd like this number to be in either seconds, minutes or hours, what am I doing wrong?</p>