Description
Elasticsearch version (bin/elasticsearch --version
): 7.7.0
elasticsearch-py
version (elasticsearch.__versionstr__
): 7.5.1
Description of the problem including expected versus actual behavior:
With previous elasticsearch version, this code snippet has worked:
bulkops.append({'_op_type': 'update',
'_index': elastic_index,
'_type': elastic_doctype,
'_id': oid,
'retry_on_conflict': 8,
'fields': '_source',
'doc': {'field_name': 'new_value'}})
res = helpers.parallel_bulk(self.es, bulkops,
raise_on_exception=False,
raise_on_error=False)
But after upgrading elasticsearch to 7.x, this fails with:
'error': "RequestError(400, 'x_content_parse_exception', '[1:2] "
"[UpdateRequest] unknown field [fields]')",
'exception': RequestError(400, 'x_content_parse_exception', {'error': {'root_cause': [{'type': 'x_content_parse_exception', 'reason': '[1:2] [UpdateRequest] unknown field [fields]'}], 'type': 'x_content_parse_exception', 'reason': '[1:2] [UpdateRequest] unknown field [fields]'}, 'status': 400}),
What I'm trying to accomplish here is to get back the modified document with the bulk updates.
With curl
, I can do the following:
curl -s -H "Content-Type: application/x-ndjson" -XPOST 'localhost:9200/_bulk?pretty&_source=true' --data-binary "@requests"
So I think the question is: how to specify query parameters with the helpers.bulk
API? As it can be seen from the doc and the above curl
call, elasticsearch itself supports this.
Steps to reproduce:
Execute the above code on a 7.x elasticsearch.