-
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
Add types deprecation to script contexts #37554
Changes from 4 commits
acfbef0
68fe20c
b89d49f
5d9b77e
e770553
6392cfc
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 |
---|---|---|
|
@@ -20,13 +20,25 @@ | |
|
||
package org.elasticsearch.script; | ||
|
||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* An update script. | ||
*/ | ||
public abstract class UpdateScript { | ||
|
||
private static final Map<String, String> DEPRECATIONS; | ||
static { | ||
Map<String, String> deprecations = new HashMap<>(); | ||
deprecations.put( | ||
"_type", | ||
"[types removal] Looking up doc types [_type] in scripts is deprecated." | ||
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. Why the prefix 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. We had to choose a shared prefix in order for there to be a consistent way to detect types deprecation messages in REST tests (and ignore them). I think @jdconrad is just using this prefix here for consistency. 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. This was copied from the other types removal messages. I'd like to keep it for consistency unless there are other objections. |
||
); | ||
DEPRECATIONS = Collections.unmodifiableMap(deprecations); | ||
} | ||
|
||
public static final String[] PARAMETERS = { }; | ||
|
||
/** The context used to compile {@link UpdateScript} factories. */ | ||
|
@@ -40,7 +52,7 @@ public abstract class UpdateScript { | |
|
||
public UpdateScript(Map<String, Object> params, Map<String, Object> ctx) { | ||
this.params = params; | ||
this.ctx = ctx; | ||
this.ctx = new DeprecationMap(ctx, DEPRECATIONS, "update_script"); | ||
} | ||
|
||
/** Return the parameters for this script. */ | ||
|
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.
nit: i would use
-
as the separator, so there is a clear distinction with the map key, since all our context names use underscores.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.
Done.