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:
Jack Conradson 2016-10-31 13:49:10 -07:00 committed by GitHub
parent 8350a8b2d8
commit 7dd4188299
5 changed files with 6 additions and 6 deletions

View File

@ -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();

View File

@ -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);

View File

@ -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"));
}

View File

@ -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);
}

View File

@ -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 }