title: How to fix the error "failed to parse date field " in Elasticsearch
body: <p>I tried to do a query in Elasticsearch via python. I want to get all values in the last one hour from now. For this I wrote this script:</p>
  <pre><code>import time
  from elasticsearch import Elasticsearch
  from datetime import datetime, timedelta
  
  es = Elasticsearch()
  index = &quot;standalone&quot;
  
  filename = &quot;2017-12-22V2.csv&quot;
  
  Timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
  one_hour_from_now = datetime.now() - timedelta(hours=1)
  one_hour_from_now = one_hour_from_now.strftime('%Y-%m-%d %H:%M:%S')
  
  
  query = {&quot;query&quot;:{&quot;bool&quot;:{&quot;must&quot;:{&quot;range&quot;:{&quot;Time&quot;:{&quot;gt&quot;:one_hour_from_now,&quot;lt&quot;:Timestamp}}},&quot;must_not&quot;:[],&quot;should&quot;:[]}},&quot;from&quot;:0,&quot;size&quot;:10,&quot;sort&quot;:[],&quot;aggs&quot;:{}}
  
  
  ret = es.search(index, body=query)
  print(&quot;ret&quot;, ret)
  </code></pre>
  <p>When I execute it I get this error:</p>
  <pre><code> es.search exception:  TransportError(400, 'search_phase_execution_exception', 'failed to parse date field [2018-02-12 15:50:26] with format [strict_date_optional_time||epoch_millis]')
  </code></pre>
  <p>This is the structure of my ES index:
  <a href="https://i.stack.imgur.com/mLwY4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mLwY4.jpg" alt="Elasticsearch structure " /></a></p>
  <p>Can someone help me please</p>
  <p>Thank you</p>