Skip to content

Allow _source parameter in bulk actions #1347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

bra-fsn
Copy link

@bra-fsn bra-fsn commented Aug 11, 2020

This fixes #1346, so if you execute:

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

instead of getting the following error back:

{'update': {'_id': 'test',
            '_index': 'index',
            '_type': '_doc',
            'data': True,
            'error': "RequestError(400, 'x_content_parse_exception', '[1:1] "
                     '[UpdateRequest] Expected START_OBJECT but was: '
                     "VALUE_BOOLEAN')",
            'exception': RequestError(400, 'x_content_parse_exception', {'error': {'root_cause': [{'type': 'x_content_parse_exception', 'reason': '[1:1] [UpdateRequest] Expected START_OBJECT but was: VALUE_BOOLEAN'}], 'type': 'x_content_parse_exception', 'reason': '[1:1] [UpdateRequest] Expected START_OBJECT but was: VALUE_BOOLEAN'}, 'status': 400}),
            'retry_on_conflict': 8,
            'status': 400}}

you'll get back the modified document at the response's ['update']['get']['_source'] path.

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

1 similar comment
@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@cla-checker-service
Copy link

❌ Author of the following commits did not sign a Contributor Agreement:
cbef06a

Please, read and sign the above mentioned agreement if you want to contribute to this project

@sethmlarson
Copy link
Contributor

Could you sign the CLA and create a unit test for this functionality?

@sethmlarson
Copy link
Contributor

Closed in favor of #1387

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to get back modified fields from a bulk update?
3 participants