Skip to content

Commit 539abde

Browse files
committed
rename
1 parent 636ad34 commit 539abde

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

docs/painless/painless-execute-script.asciidoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ The Painless execute API allows an arbitrary script to be executed and a result
99
.Parameters
1010
[options="header"]
1111
|======
12-
| Name | Required | Default | Description
13-
| `script` | yes | - | The script to execute
14-
| `context` | no | `painless_test` | The context the script should be executed in.
12+
| Name | Required | Default | Description
13+
| `script` | yes | - | The script to execute
14+
| `execute_context` | no | `painless_test` | The context the script should be executed in.
1515
|======
1616

1717
==== Contexts
@@ -77,7 +77,7 @@ POST /_scripts/painless/_execute
7777
"params": {
7878
"max_length": 4
7979
}
80-
"context": {
80+
"execute_context": {
8181
"index": "my-index",
8282
"document": {
8383
"field": "four"
@@ -121,7 +121,7 @@ POST /_scripts/painless/_execute
121121
"params": {
122122
"max_rank": 4
123123
}
124-
"context": {
124+
"execute_context": {
125125
"index": "my-index",
126126
"document": {
127127
"rank": 4

modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessExecuteAction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public Response newResponse() {
122122
public static class Request extends SingleShardRequest<Request> implements ToXContent {
123123

124124
private static final ParseField SCRIPT_FIELD = new ParseField("script");
125-
private static final ParseField CONTEXT_FIELD = new ParseField("context");
125+
private static final ParseField EXECUTE_CONTEXT_FIELD = new ParseField("execute_context");
126126
private static final ConstructingObjectParser<Request, Void> PARSER = new ConstructingObjectParser<>(
127127
"painless_execute_request", args -> new Request((Script) args[0], (ExecuteScriptContext) args[1]));
128128

@@ -139,7 +139,7 @@ public static class Request extends SingleShardRequest<Request> implements ToXCo
139139
token = p.nextToken();
140140
assert token == XContentParser.Token.END_OBJECT;
141141
return context;
142-
}, CONTEXT_FIELD);
142+
}, EXECUTE_CONTEXT_FIELD);
143143
}
144144

145145
static final Map<String, ScriptContext<?>> SUPPORTED_CONTEXTS;
@@ -386,7 +386,7 @@ public void writeTo(StreamOutput out) throws IOException {
386386
@Override
387387
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
388388
builder.field(SCRIPT_FIELD.getPreferredName(), script);
389-
builder.field(CONTEXT_FIELD.getPreferredName(), executeScriptContext);
389+
builder.field(EXECUTE_CONTEXT_FIELD.getPreferredName(), executeScriptContext);
390390
return builder;
391391
}
392392

modules/lang-painless/src/test/resources/rest-api-spec/test/painless/70_execute_painless_scripts.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ setup:
3535
params:
3636
var1: 10
3737
var2: 100
38-
context:
38+
execute_context:
3939
painless_test: {}
4040
- match: { result: "-90" }
4141

@@ -48,7 +48,7 @@ setup:
4848
source: "doc['field'].value.length() <= params.max_length"
4949
params:
5050
max_length: 4
51-
context:
51+
execute_context:
5252
filter:
5353
document:
5454
field: "four"
@@ -64,7 +64,7 @@ setup:
6464
source: "doc['rank'].value / params.max_rank"
6565
params:
6666
max_rank: 5.0
67-
context:
67+
execute_context:
6868
score:
6969
document:
7070
rank: 4
@@ -78,7 +78,7 @@ setup:
7878
source: "Math.round((_score + (doc['rank'].value / params.max_rank)) * 100.0) / 100.0"
7979
params:
8080
max_rank: 5.0
81-
context:
81+
execute_context:
8282
score:
8383
document:
8484
rank: 4

0 commit comments

Comments
 (0)