-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Scripting: Replace Update Context #32096
Changes from all commits
44bc7e8
c4c572e
a560645
38601f9
3bb2eea
228e465
aa74ff8
78d6945
7700395
8473a26
aa12c43
049606c
49e1875
77d3e60
6083196
2ef1e5c
21728f4
699f5eb
f526340
5671b5e
9cf2034
0df2ce0
35d9445
329feea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,7 +132,7 @@ | |
body: | ||
script: | ||
lang: painless | ||
source: "for (def key : params.keySet()) { ctx._source[key] = params[key]}" | ||
source: "ctx._source.ctx = ctx" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this creating a cycle in _source? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rjernst that's the point, see what it matches a few lines down and my PR description https://github.com/elastic/elasticsearch/pull/32096/files/049606c19854ac69ee07f2ff5d772f02532f769a#diff-585f6613de46bec6547c7b2aed89db8bR140 :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, thanks, sorry I missed that. |
||
params: { bar: 'xxx' } | ||
|
||
- match: { error.root_cause.0.type: "remote_transport_exception" } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.elasticsearch.script; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* An update script. | ||
*/ | ||
public abstract class UpdateScript { | ||
|
||
public static final String[] PARAMETERS = { "ctx" }; | ||
|
||
/** The context used to compile {@link UpdateScript} factories. */ | ||
public static final ScriptContext<Factory> CONTEXT = new ScriptContext<>("update", Factory.class); | ||
|
||
/** The generic runtime parameters for the script. */ | ||
private final Map<String, Object> params; | ||
|
||
public UpdateScript(Map<String, Object> params) { | ||
this.params = params; | ||
} | ||
|
||
/** Return the parameters for this script. */ | ||
public Map<String, Object> getParams() { | ||
return params; | ||
} | ||
|
||
public abstract void execute(Map<String, Object> ctx); | ||
|
||
public interface Factory { | ||
UpdateScript newInstance(Map<String, Object> params); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is set in BuildPlugin, it shouldn't be necessary here or anywhere else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right my bad that was just a random leftover from other experiments. Removing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah no I needed this because it's in the integration test definition not the unit test definition that is inherited.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrm, are you sure? BuildPlugin.commonTestConfig should be shared by both
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rjernst yea def. I even debugged this locally and it failed like on Jenkins with the deprecation line.