Skip to content
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

Allow document to be overwritten in onDocument iteratee of bulk helper #1732

Merged
merged 2 commits into from
Jul 20, 2023

Conversation

robdasilva
Copy link
Contributor

Allows the document to be submitted to be altered in the onDocument iteratee of the bulk method of the Elasticsearch Client Helpers.

Fixes #1209

@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?

@robdasilva
Copy link
Contributor Author

@delvedor Is this PR something we could merge? Anything I can do to speed up/help with the process?

@JoshMock
Copy link
Member

Thanks for this fix @robdasilva. @delvedor is no longer the maintainer of this library, and I am taking over. I'll try to take a look soon to make sure this looks good.

@robdasilva
Copy link
Contributor Author

Thanks for the heads-up, @JoshMock. Let me know, if anything.

@JoshMock
Copy link
Member

jenkins test this

Copy link
Member

@JoshMock JoshMock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this approach, even more than the two proposals in #1209, because it is a non-breaking change to the onDocument return type! Everyone wins.

I did some local tests with it and it seems to work as advertised, so I'll merge shortly, add some docs to reflect the improvement, and try to get it out in 8.8.2 and 8.9.0.

type UpdateAction = [UpdateActionOperation, Record<string, any>]
type CreateAction = CreateActionOperation | [CreateActionOperation, unknown]
type IndexAction = IndexActionOperation | [IndexActionOperation, unknown]
type UpdateAction = [UpdateActionOperation, T.BulkUpdateAction]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, not sure why this was Record before. 🤔

@JoshMock JoshMock merged commit 6b4cdee into elastic:main Jul 20, 2023
13 checks passed
JoshMock added a commit that referenced this pull request Jul 20, 2023
Adds a section detailing how to modify documents before sending to the
bulk API, using the improvement introduced in
#1732
JoshMock added a commit that referenced this pull request Jul 20, 2023
JoshMock added a commit that referenced this pull request Jul 20, 2023
JoshMock added a commit that referenced this pull request Jul 20, 2023
…tee of bulk helper (#1732)Co-authored-by: Josh Mock <[email protected]> (#1952)

Co-authored-by: Robert Da Silva <[email protected]>
JoshMock added a commit that referenced this pull request Jul 20, 2023
…tee of bulk helper (#1732)Co-authored-by: Josh Mock <[email protected]> (#1953)

Co-authored-by: Robert Da Silva <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bulk helper document manipulation
3 participants