Python update using script_id

Essentially I am trying to update an existing document using python and the update api. When I do the following in Sense it work fine. The script in stored and scripting is enabled.

POST /test/logevent/AVVQF8QuKsObI6Cw3KiB
{
  "test": "test"
}

POST /test/logevent/AVVQF8QuKsObI6Cw3KiB/_update?lang=groovy&script_id=event_setpoint_vacuum

GET /test/logevent/AVVQF8QuKsObI6Cw3KiB

As the output I get

{
  "_index": "test",
  "_type": "logevent",
  "_id": "AVVQF8QuKsObI6Cw3KiB",
  "_version": 2,
  "found": true,
  "_source": {
    "test": "test",
    "extraction": {},
    "last_updated": "2016-06-14T18:07:02.318Z"
  }
}

Which is what I expect. However, if I call the update via the python API with the following code

def update(self, id, script_id):
    return self.es.update(
        index=configuration.TEST_INDEX,
        doc_type='logevent',
        id=id,
        script_id=script_id,
        lang='groovy',
        params={},
    )

I see in the logging info

2016-06-14 11:48:17,110 | elasticsearch                  | WARNING  | POST /test/logevent/AVVQF8QuKsObI6Cw3KiB/_update?lang=groovy&script_id=event_setpoint_vacuum [status:400 request:0.081s]

This is the more detailed error message:

Error
Traceback (most recent call last):
  File "/home/theeren/PyCharmProjects/logalizerES/events/test_setpoint_vacuum.py", line 54, in test_search_setpoint_decrement_extrusion_max
    self.update(id, Event.id)
  File "/home/theeren/PyCharmProjects/logalizerES/elasticcore.py", line 128, in update
    params={},
  File "/home/theeren/logalizervenv/local/lib/python2.7/site-packages/elasticsearch/client/utils.py", line 69, in _wrapped
    return func(*args, params=params, **kwargs)
  File "/home/theeren/logalizervenv/local/lib/python2.7/site-packages/elasticsearch/client/__init__.py", line 460, in update
    doc_type, id, '_update'), params=params, body=body)
  File "/home/theeren/logalizervenv/local/lib/python2.7/site-packages/elasticsearch/transport.py", line 329, in perform_request
    status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
  File "/home/theeren/logalizervenv/local/lib/python2.7/site-packages/elasticsearch/connection/http_urllib3.py", line 109, in perform_request
    self._raise_error(response.status, raw_data)
  File "/home/theeren/logalizervenv/local/lib/python2.7/site-packages/elasticsearch/connection/base.py", line 108, in _raise_error
    raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
RequestError: TransportError(400, u'illegal_argument_exception', u'[Ultra-Marine][10.0.20.213:9300][indices:data/write/update[s]]')

I can not figure out what is wrong here.

Hi, at first glance everything seems correct, could you please enable DEBUG logging for elasticsearch logger to also see the body being sent?

import logging
logger = logging.getLogger('elasticsearch')
logger.setLevel(logging.DEBUG)

Thanks!