File tree 6 files changed +34
-20
lines changed
modules/lang-painless/src/test/resources/rest-api-spec/test/painless
plugins/examples/painless-whitelist/src/test/resources/rest-api-spec/test/painless_whitelist
main/java/org/elasticsearch/test/rest/yaml/section
test/java/org/elasticsearch/test/rest/yaml/section
6 files changed +34
-20
lines changed Original file line number Diff line number Diff line change 23
23
indices.refresh : {}
24
24
25
25
- do :
26
- index : test
27
26
search :
27
+ index : test
28
28
body :
29
29
query :
30
30
script :
45
45
- match : { hits.hits.1.fields.sNum1.0: 3.0 }
46
46
47
47
- do :
48
- index : test
49
48
search :
49
+ index : test
50
50
body :
51
51
query :
52
52
script :
70
70
- match : { hits.hits.1.fields.sNum1.0: 3.0 }
71
71
72
72
- do :
73
- index : test
74
73
search :
74
+ index : test
75
75
body :
76
76
query :
77
77
script :
96
96
- match : { hits.hits.2.fields.sNum1.0: 3.0 }
97
97
98
98
- do :
99
- index : test
100
99
search :
100
+ index : test
101
101
body :
102
102
query :
103
103
script :
127
127
indices.refresh : {}
128
128
129
129
- do :
130
- index : test
131
130
search :
131
+ index : test
132
132
body :
133
133
query :
134
134
function_score :
149
149
- match : { hits.hits.1._id: "1" }
150
150
151
151
- do :
152
- index : test
153
152
search :
153
+ index : test
154
154
body :
155
155
query :
156
156
function_score :
171
171
- match : { hits.hits.1._id: "2" }
172
172
173
173
- do :
174
- index : test
175
174
search :
175
+ index : test
176
176
body :
177
177
query :
178
178
function_score :
193
193
- match : { hits.hits.1._id: "1" }
194
194
195
195
- do :
196
- index : test
197
196
search :
197
+ index : test
198
198
body :
199
199
query :
200
200
function_score :
215
215
- match : { hits.hits.1._id: "1" }
216
216
217
217
- do :
218
- index : test
219
218
search :
219
+ index : test
220
220
body :
221
221
query :
222
222
function_score :
237
237
- match : { hits.hits.1._id: "1" }
238
238
239
239
- do :
240
- index : test
241
240
search :
241
+ index : test
242
242
body :
243
243
query :
244
244
function_score :
274
274
indices.refresh : {}
275
275
276
276
- do :
277
- index : test
278
277
search :
278
+ index : test
279
279
body :
280
280
query :
281
281
function_score :
325
325
326
326
327
327
- do :
328
- index : test
329
328
search :
329
+ index : test
330
330
body :
331
331
query :
332
332
function_score :
364
364
365
365
366
366
- do :
367
- index : test
368
367
search :
368
+ index : test
369
369
body :
370
370
script_fields :
371
371
foobar :
391
391
392
392
393
393
- do :
394
- index : test
395
394
search :
395
+ index : test
396
396
body :
397
397
aggs :
398
398
value_agg :
428
428
429
429
- do :
430
430
catch : bad_request
431
- index : test
432
431
search :
432
+ index : test
433
433
body :
434
434
aggs :
435
435
genre :
Original file line number Diff line number Diff line change 11
11
indices.refresh : {}
12
12
13
13
- do :
14
- index : test
15
14
search :
15
+ index : test
16
16
body :
17
17
query :
18
18
match_all : {}
Original file line number Diff line number Diff line change 11
11
indices.refresh : {}
12
12
13
13
- do :
14
- index : test
15
14
search :
15
+ index : test
16
16
body :
17
17
query :
18
18
match_all : {}
Original file line number Diff line number Diff line change 11
11
indices.refresh : {}
12
12
13
13
- do :
14
- index : test
15
14
search :
15
+ index : test
16
16
body :
17
17
query :
18
18
match_all : {}
26
26
- match : { hits.hits.0.fields.sNum1.0: 2 }
27
27
28
28
- do :
29
- index : test
30
29
search :
30
+ index : test
31
31
body :
32
32
query :
33
33
match_all : {}
Original file line number Diff line number Diff line change @@ -106,6 +106,8 @@ public static DoSection parse(XContentParser parser) throws IOException {
106
106
} else if (token .isValue ()) {
107
107
if ("catch" .equals (currentFieldName )) {
108
108
doSection .setCatch (parser .text ());
109
+ } else {
110
+ throw new ParsingException (parser .getTokenLocation (), "unsupported field [" + currentFieldName + "]" );
109
111
}
110
112
} else if (token == XContentParser .Token .START_ARRAY ) {
111
113
if ("warnings" .equals (currentFieldName )) {
Original file line number Diff line number Diff line change 22
22
import org .apache .http .HttpHost ;
23
23
import org .elasticsearch .client .Node ;
24
24
import org .elasticsearch .client .NodeSelector ;
25
+ import org .elasticsearch .common .ParsingException ;
25
26
import org .elasticsearch .common .logging .DeprecationLogger ;
26
27
import org .elasticsearch .common .xcontent .XContent ;
27
28
import org .elasticsearch .common .xcontent .XContentLocation ;
52
53
53
54
public class DoSectionTests extends AbstractClientYamlTestFragmentParserTestCase {
54
55
55
- public void testWarningHeaders () throws IOException {
56
+ public void testWarningHeaders () {
56
57
{
57
58
final DoSection section = new DoSection (new XContentLocation (1 , 1 ));
58
59
@@ -424,6 +425,17 @@ public void testParseDoSectionWithCatch() throws Exception {
424
425
assertThat (doSection .getApiCallSection ().hasBody (), equalTo (false ));
425
426
}
426
427
428
+ public void testUnsupportedTopLevelField () throws Exception {
429
+ parser = createParser (YamlXContent .yamlXContent ,
430
+ "max_concurrent_shard_requests: 1"
431
+ );
432
+
433
+ ParsingException e = expectThrows (ParsingException .class , () -> DoSection .parse (parser ));
434
+ assertThat (e .getMessage (), is ("unsupported field [max_concurrent_shard_requests]" ));
435
+ parser .nextToken ();
436
+ parser .nextToken ();
437
+ }
438
+
427
439
public void testParseDoSectionWithHeaders () throws Exception {
428
440
parser = createParser (YamlXContent .yamlXContent ,
429
441
"headers:\n " +
You can’t perform that action at this time.
0 commit comments