|
@@ -34,10 +34,10 @@ public class IngestDocumentMustacheIT extends AbstractScriptTestCase {
|
|
Map<String, Object> document = new HashMap<>();
|
|
Map<String, Object> document = new HashMap<>();
|
|
document.put("foo", "bar");
|
|
document.put("foo", "bar");
|
|
IngestDocument ingestDocument = new IngestDocument("index", "type", "id", null, null, document);
|
|
IngestDocument ingestDocument = new IngestDocument("index", "type", "id", null, null, document);
|
|
- ingestDocument.setFieldValue(templateService.compile("field1"), ValueSource.wrap("1 {{foo}}", templateService));
|
|
|
|
|
|
+ ingestDocument.setFieldValue(compile("field1"), ValueSource.wrap("1 {{foo}}", scriptService));
|
|
assertThat(ingestDocument.getFieldValue("field1", String.class), equalTo("1 bar"));
|
|
assertThat(ingestDocument.getFieldValue("field1", String.class), equalTo("1 bar"));
|
|
|
|
|
|
- ingestDocument.setFieldValue(templateService.compile("field1"), ValueSource.wrap("2 {{_source.foo}}", templateService));
|
|
|
|
|
|
+ ingestDocument.setFieldValue(compile("field1"), ValueSource.wrap("2 {{_source.foo}}", scriptService));
|
|
assertThat(ingestDocument.getFieldValue("field1", String.class), equalTo("2 bar"));
|
|
assertThat(ingestDocument.getFieldValue("field1", String.class), equalTo("2 bar"));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -49,12 +49,12 @@ public class IngestDocumentMustacheIT extends AbstractScriptTestCase {
|
|
innerObject.put("qux", Collections.singletonMap("fubar", "hello qux and fubar"));
|
|
innerObject.put("qux", Collections.singletonMap("fubar", "hello qux and fubar"));
|
|
document.put("foo", innerObject);
|
|
document.put("foo", innerObject);
|
|
IngestDocument ingestDocument = new IngestDocument("index", "type", "id", null, null, document);
|
|
IngestDocument ingestDocument = new IngestDocument("index", "type", "id", null, null, document);
|
|
- ingestDocument.setFieldValue(templateService.compile("field1"),
|
|
|
|
- ValueSource.wrap("1 {{foo.bar}} {{foo.baz}} {{foo.qux.fubar}}", templateService));
|
|
|
|
|
|
+ ingestDocument.setFieldValue(compile("field1"),
|
|
|
|
+ ValueSource.wrap("1 {{foo.bar}} {{foo.baz}} {{foo.qux.fubar}}", scriptService));
|
|
assertThat(ingestDocument.getFieldValue("field1", String.class), equalTo("1 hello bar hello baz hello qux and fubar"));
|
|
assertThat(ingestDocument.getFieldValue("field1", String.class), equalTo("1 hello bar hello baz hello qux and fubar"));
|
|
|
|
|
|
- ingestDocument.setFieldValue(templateService.compile("field1"),
|
|
|
|
- ValueSource.wrap("2 {{_source.foo.bar}} {{_source.foo.baz}} {{_source.foo.qux.fubar}}", templateService));
|
|
|
|
|
|
+ ingestDocument.setFieldValue(compile("field1"),
|
|
|
|
+ ValueSource.wrap("2 {{_source.foo.bar}} {{_source.foo.baz}} {{_source.foo.qux.fubar}}", scriptService));
|
|
assertThat(ingestDocument.getFieldValue("field1", String.class), equalTo("2 hello bar hello baz hello qux and fubar"));
|
|
assertThat(ingestDocument.getFieldValue("field1", String.class), equalTo("2 hello bar hello baz hello qux and fubar"));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -68,7 +68,7 @@ public class IngestDocumentMustacheIT extends AbstractScriptTestCase {
|
|
list.add(null);
|
|
list.add(null);
|
|
document.put("list2", list);
|
|
document.put("list2", list);
|
|
IngestDocument ingestDocument = new IngestDocument("index", "type", "id", null, null, document);
|
|
IngestDocument ingestDocument = new IngestDocument("index", "type", "id", null, null, document);
|
|
- ingestDocument.setFieldValue(templateService.compile("field1"), ValueSource.wrap("1 {{list1.0}} {{list2.0}}", templateService));
|
|
|
|
|
|
+ ingestDocument.setFieldValue(compile("field1"), ValueSource.wrap("1 {{list1.0}} {{list2.0}}", scriptService));
|
|
assertThat(ingestDocument.getFieldValue("field1", String.class), equalTo("1 foo {field=value}"));
|
|
assertThat(ingestDocument.getFieldValue("field1", String.class), equalTo("1 foo {field=value}"));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -78,8 +78,8 @@ public class IngestDocumentMustacheIT extends AbstractScriptTestCase {
|
|
ingestMap.put("timestamp", "bogus_timestamp");
|
|
ingestMap.put("timestamp", "bogus_timestamp");
|
|
document.put("_ingest", ingestMap);
|
|
document.put("_ingest", ingestMap);
|
|
IngestDocument ingestDocument = new IngestDocument("index", "type", "id", null, null, document);
|
|
IngestDocument ingestDocument = new IngestDocument("index", "type", "id", null, null, document);
|
|
- ingestDocument.setFieldValue(templateService.compile("ingest_timestamp"),
|
|
|
|
- ValueSource.wrap("{{_ingest.timestamp}} and {{_source._ingest.timestamp}}", templateService));
|
|
|
|
|
|
+ ingestDocument.setFieldValue(compile("ingest_timestamp"),
|
|
|
|
+ ValueSource.wrap("{{_ingest.timestamp}} and {{_source._ingest.timestamp}}", scriptService));
|
|
assertThat(ingestDocument.getFieldValue("ingest_timestamp", String.class),
|
|
assertThat(ingestDocument.getFieldValue("ingest_timestamp", String.class),
|
|
equalTo(ingestDocument.getIngestMetadata().get("timestamp") + " and bogus_timestamp"));
|
|
equalTo(ingestDocument.getIngestMetadata().get("timestamp") + " and bogus_timestamp"));
|
|
}
|
|
}
|