Skip to content

Expose ctx._now in update scripts #20835

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

Merged
merged 1 commit into from
Oct 10, 2016

Conversation

s1monw
Copy link
Contributor

@s1monw s1monw commented Oct 10, 2016

Update scripts might want to update the documents _timestamp but need a notion of now().
Painless doesn't support any notion of now() since it would make scripts non-pure functions. Yet,
in the update case this is a valid value and we can pass it with the context together to allow the
script to record the timestamp the document was updated.

Relates to #17895

Update scripts might want to update the documents `_timestamp` but need a notion of `now()`.
Painless doesn't support any notion of now() since it would make scripts non-pure functions. Yet,
in the update case this is a valid value and we can pass it with the context together to allow the
script to record the timestamp the documetn was updated.

Relates to elastic#17895
@s1monw s1monw added >enhancement :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache v6.0.0-alpha1 v5.1.1 labels Oct 10, 2016
@s1monw
Copy link
Contributor Author

s1monw commented Oct 10, 2016

@rjernst @clintongormley can you look

@rjernst
Copy link
Member

rjernst commented Oct 10, 2016

LGTM

@s1monw s1monw merged commit 37ca38d into elastic:master Oct 10, 2016
s1monw added a commit that referenced this pull request Oct 10, 2016
Update scripts might want to update the documents `_timestamp` but need a notion of `now()`.
Painless doesn't support any notion of now() since it would make scripts non-pure functions. Yet,
in the update case this is a valid value and we can pass it with the context together to allow the
script to record the timestamp the document was updated.

Relates to #17895
clintongormley added a commit that referenced this pull request Oct 11, 2016
clintongormley added a commit that referenced this pull request Oct 11, 2016
clintongormley added a commit that referenced this pull request Oct 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Scripting Scripting abstractions, Painless, and Mustache >enhancement v5.1.1 v6.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants