title: elasticsearch watcher not displaying correct time with format
body: <p>I'm building a watcher to send alerts based on when this index gets reports of a failed job. In the "Discover" tab the date <code>NextRunDate</code> shows perfectly fine:</p>
  
  <pre><code>JobName      MyJobName
  NextRunDate  Feb 29, 2020 @ 06:30 AM
  </code></pre>
  
  <p>But when I try to pull it with the watcher it is somehow behind:</p>
  
  <pre><code>"key" : "MyJobName",
  "NextRunDate" : {
  "doc_count_error_upper_bound" : 0,
  "sum_other_doc_count" : 0,
  "buckets" : [
      {
      "key_as_string" : "Feb 29 @ 11:30 AM (Minus 5 hours)",
      "doc_count" : 24,
      "key" : 1582975800000
      }
    ]
  }
  </code></pre>
  
  <p>I've had to add the "(Minus 5 hours)" part to the query in order for it to display correctly for the time being. Here's the full watcher:</p>
  
  <pre><code>POST _watcher/watch/_execute
  {
      "watch": {
          "trigger": {
              "schedule": {
                  "hourly": {
                      "minute": [
                          0,
                          15,
                          30,
                          45
                      ]
                  }
              }
          },
          "input": {
              "search": {
                  "request": {
                      "search_type": "query_then_fetch",
                      "indices": [
                          "prod-jobs-*"
                      ],
                      "rest_total_hits_as_int": true,
                      "body": {
                          "size": 0,
                          "query": {
                              "bool": {
                                  "filter": {
                                      "range": {
                                          "timestamp": {
                                              "gte": "now-15h"
                                          }
                                      }
                                  },
                                  "must": [
                                      {
                                          "match_all": {}
                                      }
                                  ]
                              }
                          },
                          "aggs": {
                              "JobName": {
                                  "terms": {
                                      "field": "JobName.keyword",
                                      "size": 5000,
                                      "order": {
                                          "_key": "desc"
                                      }
                                  },
                                  "aggs": {
                                      "PackageName": {
                                          "terms": {
                                              "field": "Package_Name.keyword",
                                              "size": 5000,
                                              "order": {
                                                  "_key": "desc"
                                              }
                                          },
                                          "aggs": {
                                              "Error_Message": {
                                                  "terms": {
                                                      "field": "Error_Message.keyword",
                                                      "size": 5000,
                                                      "order": {
                                                          "_key": "desc"
                                                      }
                                                  }
                                              }
                                          }
                                      },
                                      "FailedDate": {
                                          "terms": {
                                              "field": "StopExecutionDate",
                                              "format": "MMM d @ h:mm a '(Minus 5 hours)'"
                                          }
                                      },
                                      "NextRunDate": {
                                          "terms": {
                                              "field": "NextRunDate",
                                              "format": "MMM d @ h:mm a '(Minus 5 hours)'"
                                          }
                                      }
                                  }
                              }
                          }
                      }
                  }
              }
          },
          "condition": {
              "compare": {
                  "ctx.payload.hits.total": {
                      "gt": 0
                  }
              }
          },
          "actions": {
              "email_1": {
                  "email": {
                      "profile": "standard",
                      "to": [],
                      "subject": "{{ctx.metadata.name}} has triggered",
                      "body": {
                          "html": "&lt;html&gt; &lt;head&gt; &lt;style&gt; body { font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 'Verdana', 'sans-serif'; } table { margin-left: 15px; border-left: 1.5px solid gray } tr, th { font-size: x-small; white-space: nowrap; text-align: left; padding: 7.5px; } td { font-size: x-small; text-align: left; padding: 7.5px; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;h3&gt;Job Failures with Errors&lt;/h3&gt; {{#ctx.payload.aggregations.JobName.buckets}} &lt;table style='border-collapse: collapse; border-spacing: 0;'&gt; &lt;tr&gt; &lt;th&gt;Job Name&lt;/th&gt; &lt;td&gt;{{key}}&lt;/td&gt; &lt;tr&gt; &lt;th&gt;{{#PackageName.buckets}}Package Name&lt;/th&gt; &lt;td&gt;{{key}}&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;th&gt;Error Message(s)&lt;/th&gt; &lt;td&gt;{{#Error_Message.buckets}}{{key}}&lt;br&gt;{{/Error_Message.buckets}}&lt;/td&gt;{{/PackageName.buckets}} &lt;/tr&gt; &lt;tr&gt; &lt;th&gt;Job Fail Date/Time: &lt;/th&gt; &lt;td&gt;{{#FailedDate.buckets}}{{key_as_string}}&lt;/td&gt;{{/FailedDate.buckets}} &lt;/tr&gt; &lt;tr&gt; &lt;th&gt;Next Run Date/Time: &lt;/th&gt; &lt;td&gt;{{#NextRunDate.buckets}}{{key_as_string}}&lt;/td&gt;{{/NextRunDate.buckets}} &lt;/tr&gt; &lt;/table&gt; &lt;br&gt;{{/ctx.payload.aggregations.JobName.buckets}}&lt;br&gt; &lt;/body&gt; &lt;/html&gt;"
                      }
                  }
              }
          },
          "metadata": {
              "time_window": "5m",
              "time_period": "1m"
          }
      }
  }
  </code></pre>
  
  <p>Not sure what the problem is since kibana itself is showing the date correctly on the Discover tab. Is my <code>format</code> field off?</p>