mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-25 22:36:20 +00:00
Cleanup ScriptType (elastic/elasticsearch#3922)
Refactored ScriptType to clean up some of the variable and method names. Added more documentation. Deprecated the 'in' ParseField in favor of 'stored' to match the indexed scripts being replaced by stored scripts. Original commit: elastic/x-pack-elasticsearch@d7c7bd7362
This commit is contained in:
parent
8350a8b2d8
commit
7dd4188299
@ -109,7 +109,7 @@ public class TextTemplateTests extends ESTestCase {
|
||||
builder.field("file", template.getTemplate());
|
||||
break;
|
||||
case STORED:
|
||||
builder.field("id", template.getTemplate());
|
||||
builder.field("stored", template.getTemplate());
|
||||
}
|
||||
builder.field("params", template.getParams());
|
||||
builder.endObject();
|
||||
|
@ -220,7 +220,7 @@ public class ScriptConditionTests extends ESTestCase {
|
||||
builder.field("file", script);
|
||||
break;
|
||||
case STORED:
|
||||
builder.field("id", script);
|
||||
builder.field("stored", script);
|
||||
break;
|
||||
default:
|
||||
throw illegalArgument("unsupported script type [{}]", scriptType);
|
||||
|
@ -28,7 +28,7 @@ import static org.hamcrest.Matchers.equalTo;
|
||||
public class WatcherSearchTemplateRequestTests extends ESTestCase {
|
||||
|
||||
public void testFromXContentWithTemplateDefaultLang() throws IOException {
|
||||
String source = "{\"template\":{\"id\":\"default-script\", \"params\":{\"foo\":\"bar\"}}}";
|
||||
String source = "{\"template\":{\"stored\":\"default-script\", \"params\":{\"foo\":\"bar\"}}}";
|
||||
assertTemplate(source, "default-script", "mustache", singletonMap("foo", "bar"));
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ public class ScriptTransformTests extends ESTestCase {
|
||||
switch (type) {
|
||||
case INLINE: return "inline";
|
||||
case FILE: return "file";
|
||||
case STORED: return "id";
|
||||
case STORED: return "stored";
|
||||
default:
|
||||
throw illegalArgument("unsupported script type [{}]", type);
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ setup:
|
||||
"request" : {
|
||||
"indices" : "idx",
|
||||
"template" : {
|
||||
"id": "search-template",
|
||||
"stored": "search-template",
|
||||
"params": {
|
||||
"num": 2
|
||||
}
|
||||
@ -156,6 +156,6 @@ setup:
|
||||
- match: { "watch_record.result.input.payload.hits.hits.0._id": "2" }
|
||||
# makes sure that the mustache template snippets have been resolved correctly:
|
||||
- match: { "watch_record.result.input.search.request.body.query.bool.must.0.term.value": "val_2" }
|
||||
- match: { "watch_record.result.input.search.request.template.id": "search-template" }
|
||||
- match: { "watch_record.result.input.search.request.template.stored": "search-template" }
|
||||
- match: { "watch_record.result.input.search.request.template.lang": "mustache" }
|
||||
- match: { "watch_record.result.input.search.request.template.params.num": 2 }
|
||||
|
Loading…
x
Reference in New Issue
Block a user