title: Elastic Search - Failed to parse query
body: <p>I am using python-elasticsearch client - <a href="https://elasticsearch-py.readthedocs.io/en/master/index.html" rel="nofollow noreferrer">elasticsearch.py</a> and elastic search fails to parse query when I try to update a document using <code>update_by_query</code> method.</p>
  
  <p>My update body is as follows:</p>
  
  <pre><code>{
    'script': {
      'inline': 'ctx._source.viewers += info',
      'params': {
        'info': {
          'time': datetime.datetime(2017, 3, 7, 18, 8, 50),
          'viewer': 'abc@xyz.com'
        }
      }
    }
  }
  </code></pre>
  
  <p>Elastic Search is called as follows::</p>
  
  <pre><code>update = es.update_by_query(index=index_el,
                              doc_type='1',
                              q='delivery_reference_id:' + str(cam_id) +'',
                              body=doc)
  </code></pre>
  
  <p>A sample value for <code>cam_id</code> is: </p>
  
  <pre><code>CAM_10_DATA_4_2017-03-07 18:02:07
  </code></pre>
  
  <p>Internally, the following query is formed::</p>
  
  <p><code>http://127.0.0.1:9200/user_tracker/1/_update_by_query?q=delivery_reference_id%3ACAM_10_DATA_4_2017-03-07+18%3A02%3A07</code></p>
  
  <p>The error received is as follows:</p>
  
  <pre><code>TransportError(400, 'search_phase_execution_exception', 'Failed to parse query [delivery_reference_id:CAM_10_DATA_4_2017-03-07 18:02:07]')
  </code></pre>
  
  <p>The full error log is as follows:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Users\catch\AppData\Roaming\Python\Python34\site-packages\django\core\handlers\exception.py", line 42, in inner
      response = get_response(request)
    File "C:\Users\catch\AppData\Roaming\Python\Python34\site-packages\django\core\handlers\base.py", line 187, in _get_response
      response = self.process_exception_by_middleware(e, request)
    File "C:\Users\catch\AppData\Roaming\Python\Python34\site-packages\django\core\handlers\base.py", line 185, in _get_response
      response = wrapped_callback(request, *callback_args, **callback_kwargs)
    File "C:\Users\catch\AppData\Roaming\Python\Python34\site-packages\django\views\decorators\csrf.py", line 58, in wrapped_view
      return view_func(*args, **kwargs)
    File "C:\Users\catch\AppData\Roaming\Python\Python34\site-packages\django\views\generic\base.py", line 68, in view
      return self.dispatch(request, *args, **kwargs)
    File "C:\Python34\lib\site-packages\rest_framework\views.py", line 483, in dispatch
      response = self.handle_exception(exc)
    File "C:\Python34\lib\site-packages\rest_framework\views.py", line 443, in handle_exception
      self.raise_uncaught_exception(exc)
    File "C:\Python34\lib\site-packages\rest_framework\views.py", line 480, in dispatch
      response = handler(request, *args, **kwargs)
    File "C:\Users\catch\PycharmProjects\myproject\myproj\apis\views.py", line 516, in get
      viewer=viewer_email)
    File "C:\Users\catch\PycharmProjects\myproject\myproj\apis\views.py", line 541, in update_track_info
      doc=doc)
    File "C:\Users\catch\PycharmProjects\myproject\myproj\apis\views.py", line 553, in es_update
      body=doc)
    File "C:\Python34\lib\site-packages\elasticsearch\client\utils.py", line 73, in _wrapped
      return func(*args, params=params, **kwargs)
    File "C:\Python34\lib\site-packages\elasticsearch\client\__init__.py", line 680, in update_by_query
      doc_type, '_update_by_query'), params=params, body=body)
    File "C:\Python34\lib\site-packages\elasticsearch\transport.py", line 318, in perform_request
      status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
    File "C:\Python34\lib\site-packages\elasticsearch\connection\http_urllib3.py", line 128, in perform_request
      self._raise_error(response.status, raw_data)
    File "C:\Python34\lib\site-packages\elasticsearch\connection\base.py", line 122, in _raise_error
      raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
  elasticsearch.exceptions.RequestError: TransportError(400, 'search_phase_execution_exception', 'Failed to parse query [delivery_reference_id:CAM_10_DATA_4_2017-03-07 18:02:07]')
  </code></pre>
  
  <p>Would be nice if someone figured it out. Let me know if more info is needed.</p>
  
  <p>Appreciate it. Thanks in advance.</p>