How to return the modified document with bulk update

Previously (not sure about the versions, but I can't see errors with 6.8) I could use the bulk API to update a doc and to get back the modified document with (snippet from actual code using the Python Elastic client):

bulkops.append({'_op_type': 'update',
                                '_index': elastic_index,
                                '_type': elastic_doctype,
                                '_id': oid,
                                'retry_on_conflict': 8,
                                'fields': '_source',
                                'doc': changes})
res = helpers.parallel_bulk(self.es, bulkops,
                                            raise_on_exception=False,
                                            raise_on_error=False)

however with 7.8 this gives the following error:

'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}),

According to the docs here:
https://www.elastic.co/guide/en/elasticsearch/reference/7.8/docs-update.html
the _source could control what should it return, but I've got no luck with that either.

So my question is: how could I get back the modified document with a bulk update?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.