Replace property with field in IngestDocument
getPropertyValue => getFieldValue hasPropertyValue => hasFieldValue setPropertyValue => setFieldValue removeProperty => removeField
This commit is contained in:
parent
e15fa99ee3
commit
ec162c458e
|
@ -53,7 +53,7 @@ public final class IngestDocument {
|
|||
* @return the value for the provided path if existing, null otherwise
|
||||
* @throws IllegalArgumentException if the field is present but is not of the type provided as argument.
|
||||
*/
|
||||
public <T> T getPropertyValue(String path, Class<T> clazz) {
|
||||
public <T> T getFieldValue(String path, Class<T> clazz) {
|
||||
if (path == null || path.length() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
@ -66,22 +66,22 @@ public final class IngestDocument {
|
|||
}
|
||||
|
||||
String leafKey = pathElements[pathElements.length - 1];
|
||||
Object property = innerMap.get(leafKey);
|
||||
if (property == null) {
|
||||
Object fieldValue = innerMap.get(leafKey);
|
||||
if (fieldValue == null) {
|
||||
return null;
|
||||
}
|
||||
if (clazz.isInstance(property)) {
|
||||
return clazz.cast(property);
|
||||
if (clazz.isInstance(fieldValue)) {
|
||||
return clazz.cast(fieldValue);
|
||||
}
|
||||
throw new IllegalArgumentException("field [" + path + "] of type [" + property.getClass().getName() + "] cannot be cast to [" + clazz.getName() + "]");
|
||||
throw new IllegalArgumentException("field [" + path + "] of type [" + fieldValue.getClass().getName() + "] cannot be cast to [" + clazz.getName() + "]");
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the document contains a value for the provided path
|
||||
* @param path The path within the document in dot-notation
|
||||
* @return true if the document contains a value for the property, false otherwise
|
||||
* @return true if the document contains a value for the field, false otherwise
|
||||
*/
|
||||
public boolean hasPropertyValue(String path) {
|
||||
public boolean hasFieldValue(String path) {
|
||||
if (path == null || path.length() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -96,10 +96,10 @@ public final class IngestDocument {
|
|||
}
|
||||
|
||||
/**
|
||||
* Removes the property identified by the provided path
|
||||
* @param path the path of the property to be removed
|
||||
* Removes the field identified by the provided path
|
||||
* @param path the path of the field to be removed
|
||||
*/
|
||||
public void removeProperty(String path) {
|
||||
public void removeField(String path) {
|
||||
if (path == null || path.length() == 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ public final class IngestDocument {
|
|||
* @param path The path within the document in dot-notation
|
||||
* @param value The value to put in for the path key
|
||||
*/
|
||||
public void setPropertyValue(String path, Object value) {
|
||||
public void setFieldValue(String path, Object value) {
|
||||
if (path == null || path.length() == 0) {
|
||||
throw new IllegalArgumentException("cannot add null or empty field");
|
||||
}
|
||||
|
@ -175,8 +175,8 @@ public final class IngestDocument {
|
|||
|
||||
/**
|
||||
* Returns the document. Should be used only for reading. Any change made to the returned map will
|
||||
* not be reflected to the modified flag. Modify the document instead using {@link #setPropertyValue(String, Object)}
|
||||
* and {@link #removeProperty(String)}
|
||||
* not be reflected to the modified flag. Modify the document instead using {@link #setFieldValue(String, Object)}
|
||||
* and {@link #removeField(String)}
|
||||
*/
|
||||
public Map<String, Object> getSource() {
|
||||
return source;
|
||||
|
|
|
@ -46,11 +46,11 @@ public abstract class AbstractStringProcessor implements Processor {
|
|||
@Override
|
||||
public final void execute(IngestDocument document) {
|
||||
for(String field : fields) {
|
||||
String val = document.getPropertyValue(field, String.class);
|
||||
String val = document.getFieldValue(field, String.class);
|
||||
if (val == null) {
|
||||
throw new IllegalArgumentException("field [" + field + "] is null, cannot process it.");
|
||||
}
|
||||
document.setPropertyValue(field, process(val));
|
||||
document.setFieldValue(field, process(val));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public class AddProcessor implements Processor {
|
|||
@Override
|
||||
public void execute(IngestDocument document) {
|
||||
for(Map.Entry<String, Object> entry : fields.entrySet()) {
|
||||
document.setPropertyValue(entry.getKey(), entry.getValue());
|
||||
document.setFieldValue(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ public class ConvertProcessor implements Processor {
|
|||
public void execute(IngestDocument document) {
|
||||
for(Map.Entry<String, Type> entry : fields.entrySet()) {
|
||||
Type type = entry.getValue();
|
||||
Object oldValue = document.getPropertyValue(entry.getKey(), Object.class);
|
||||
Object oldValue = document.getFieldValue(entry.getKey(), Object.class);
|
||||
Object newValue;
|
||||
if (oldValue == null) {
|
||||
throw new IllegalArgumentException("Field [" + entry.getKey() + "] is null, cannot be converted to type [" + type + "]");
|
||||
|
@ -118,7 +118,7 @@ public class ConvertProcessor implements Processor {
|
|||
} else {
|
||||
newValue = type.convert(oldValue);
|
||||
}
|
||||
document.setPropertyValue(entry.getKey(), newValue);
|
||||
document.setFieldValue(entry.getKey(), newValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public final class DateProcessor implements Processor {
|
|||
|
||||
@Override
|
||||
public void execute(IngestDocument ingestDocument) {
|
||||
String value = ingestDocument.getPropertyValue(matchField, String.class);
|
||||
String value = ingestDocument.getFieldValue(matchField, String.class);
|
||||
// TODO(talevy): handle custom timestamp fields
|
||||
|
||||
DateTime dateTime = null;
|
||||
|
@ -80,7 +80,7 @@ public final class DateProcessor implements Processor {
|
|||
throw new IllegalArgumentException("unable to parse date [" + value + "]", lastException);
|
||||
}
|
||||
|
||||
ingestDocument.setPropertyValue(targetField, ISODateTimeFormat.dateTime().print(dateTime));
|
||||
ingestDocument.setFieldValue(targetField, ISODateTimeFormat.dateTime().print(dateTime));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -61,7 +61,7 @@ public final class GeoIpProcessor implements Processor {
|
|||
|
||||
@Override
|
||||
public void execute(IngestDocument ingestDocument) {
|
||||
String ip = ingestDocument.getPropertyValue(sourceField, String.class);
|
||||
String ip = ingestDocument.getFieldValue(sourceField, String.class);
|
||||
final InetAddress ipAddress;
|
||||
try {
|
||||
ipAddress = InetAddress.getByName(ip);
|
||||
|
@ -88,7 +88,7 @@ public final class GeoIpProcessor implements Processor {
|
|||
default:
|
||||
throw new IllegalStateException("Unsupported database type [" + dbReader.getMetadata().getDatabaseType() + "]");
|
||||
}
|
||||
ingestDocument.setPropertyValue(targetField, geoData);
|
||||
ingestDocument.setFieldValue(targetField, geoData);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -46,12 +46,12 @@ public final class GrokProcessor implements Processor {
|
|||
|
||||
@Override
|
||||
public void execute(IngestDocument ingestDocument) {
|
||||
Object field = ingestDocument.getPropertyValue(matchField, Object.class);
|
||||
Object field = ingestDocument.getFieldValue(matchField, Object.class);
|
||||
// TODO(talevy): handle invalid field types
|
||||
if (field instanceof String) {
|
||||
Map<String, Object> matches = grok.captures((String) field);
|
||||
if (matches != null) {
|
||||
matches.forEach((k, v) -> ingestDocument.setPropertyValue(k, v));
|
||||
matches.forEach((k, v) -> ingestDocument.setFieldValue(k, v));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,13 +51,13 @@ public class GsubProcessor implements Processor {
|
|||
@Override
|
||||
public void execute(IngestDocument document) {
|
||||
for (GsubExpression gsubExpression : gsubExpressions) {
|
||||
String oldVal = document.getPropertyValue(gsubExpression.getFieldName(), String.class);
|
||||
String oldVal = document.getFieldValue(gsubExpression.getFieldName(), String.class);
|
||||
if (oldVal == null) {
|
||||
throw new IllegalArgumentException("field [" + gsubExpression.getFieldName() + "] is null, cannot match pattern.");
|
||||
}
|
||||
Matcher matcher = gsubExpression.getPattern().matcher(oldVal);
|
||||
String newVal = matcher.replaceAll(gsubExpression.getReplacement());
|
||||
document.setPropertyValue(gsubExpression.getFieldName(), newVal);
|
||||
document.setFieldValue(gsubExpression.getFieldName(), newVal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,14 +50,14 @@ public class JoinProcessor implements Processor {
|
|||
@Override
|
||||
public void execute(IngestDocument document) {
|
||||
for(Map.Entry<String, String> entry : fields.entrySet()) {
|
||||
List<?> list = document.getPropertyValue(entry.getKey(), List.class);
|
||||
List<?> list = document.getFieldValue(entry.getKey(), List.class);
|
||||
if (list == null) {
|
||||
throw new IllegalArgumentException("field [" + entry.getKey() + "] is null, cannot join.");
|
||||
}
|
||||
String joined = list.stream()
|
||||
.map(Object::toString)
|
||||
.collect(Collectors.joining(entry.getValue()));
|
||||
document.setPropertyValue(entry.getKey(), joined);
|
||||
document.setFieldValue(entry.getKey(), joined);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public class RemoveProcessor implements Processor {
|
|||
@Override
|
||||
public void execute(IngestDocument document) {
|
||||
for(String field : fields) {
|
||||
document.removeProperty(field);
|
||||
document.removeField(field);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,13 +47,13 @@ public class RenameProcessor implements Processor {
|
|||
@Override
|
||||
public void execute(IngestDocument document) {
|
||||
for(Map.Entry<String, String> entry : fields.entrySet()) {
|
||||
if (document.hasPropertyValue(entry.getKey())) {
|
||||
if (document.hasPropertyValue(entry.getKey()) == false) {
|
||||
if (document.hasFieldValue(entry.getKey())) {
|
||||
if (document.hasFieldValue(entry.getKey()) == false) {
|
||||
throw new IllegalArgumentException("field [" + entry.getKey() + "] doesn't exist");
|
||||
}
|
||||
Object oldValue = document.getPropertyValue(entry.getKey(), Object.class);
|
||||
document.removeProperty(entry.getKey());
|
||||
document.setPropertyValue(entry.getValue(), oldValue);
|
||||
Object oldValue = document.getFieldValue(entry.getKey(), Object.class);
|
||||
document.removeField(entry.getKey());
|
||||
document.setFieldValue(entry.getValue(), oldValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,11 +50,11 @@ public class SplitProcessor implements Processor {
|
|||
@Override
|
||||
public void execute(IngestDocument document) {
|
||||
for(Map.Entry<String, String> entry : fields.entrySet()) {
|
||||
String oldVal = document.getPropertyValue(entry.getKey(), String.class);
|
||||
String oldVal = document.getFieldValue(entry.getKey(), String.class);
|
||||
if (oldVal == null) {
|
||||
throw new IllegalArgumentException("field [" + entry.getKey() + "] is null, cannot split.");
|
||||
}
|
||||
document.setPropertyValue(entry.getKey(), Arrays.asList(oldVal.split(entry.getValue())));
|
||||
document.setFieldValue(entry.getKey(), Arrays.asList(oldVal.split(entry.getValue())));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,91 +44,91 @@ public class IngestDocumentTests extends ESTestCase {
|
|||
ingestDocument = new IngestDocument("index", "type", "id", document);
|
||||
}
|
||||
|
||||
public void testSimpleGetPropertyValue() {
|
||||
assertThat(ingestDocument.getPropertyValue("foo", String.class), equalTo("bar"));
|
||||
assertThat(ingestDocument.getPropertyValue("int", Integer.class), equalTo(123));
|
||||
public void testSimpleGetFieldValue() {
|
||||
assertThat(ingestDocument.getFieldValue("foo", String.class), equalTo("bar"));
|
||||
assertThat(ingestDocument.getFieldValue("int", Integer.class), equalTo(123));
|
||||
}
|
||||
|
||||
public void testGetPropertyValueNullValue() {
|
||||
assertThat(ingestDocument.getPropertyValue("fizz.foo_null", Object.class), nullValue());
|
||||
public void testGetFieldValueNullValue() {
|
||||
assertThat(ingestDocument.getFieldValue("fizz.foo_null", Object.class), nullValue());
|
||||
}
|
||||
|
||||
public void testSimpleGetPropertyValueTypeMismatch() {
|
||||
public void testSimpleGetFieldValueTypeMismatch() {
|
||||
try {
|
||||
ingestDocument.getPropertyValue("int", String.class);
|
||||
fail("getProperty should have failed");
|
||||
ingestDocument.getFieldValue("int", String.class);
|
||||
fail("getFieldValue should have failed");
|
||||
} catch(IllegalArgumentException e) {
|
||||
assertThat(e.getMessage(), equalTo("field [int] of type [java.lang.Integer] cannot be cast to [java.lang.String]"));
|
||||
}
|
||||
|
||||
try {
|
||||
ingestDocument.getPropertyValue("foo", Integer.class);
|
||||
fail("getProperty should have failed");
|
||||
ingestDocument.getFieldValue("foo", Integer.class);
|
||||
fail("getFieldValue should have failed");
|
||||
} catch(IllegalArgumentException e) {
|
||||
assertThat(e.getMessage(), equalTo("field [foo] of type [java.lang.String] cannot be cast to [java.lang.Integer]"));
|
||||
}
|
||||
}
|
||||
|
||||
public void testNestedGetPropertyValue() {
|
||||
assertThat(ingestDocument.getPropertyValue("fizz.buzz", String.class), equalTo("hello world"));
|
||||
public void testNestedGetFieldValue() {
|
||||
assertThat(ingestDocument.getFieldValue("fizz.buzz", String.class), equalTo("hello world"));
|
||||
}
|
||||
|
||||
public void testGetPropertyValueNotFound() {
|
||||
assertThat(ingestDocument.getPropertyValue("not.here", String.class), nullValue());
|
||||
public void testGetFieldValueNotFound() {
|
||||
assertThat(ingestDocument.getFieldValue("not.here", String.class), nullValue());
|
||||
}
|
||||
|
||||
public void testGetPropertyValueNull() {
|
||||
assertNull(ingestDocument.getPropertyValue(null, String.class));
|
||||
public void testGetFieldValueNull() {
|
||||
assertNull(ingestDocument.getFieldValue(null, String.class));
|
||||
}
|
||||
|
||||
public void testGetPropertyValueEmpty() {
|
||||
assertNull(ingestDocument.getPropertyValue("", String.class));
|
||||
public void testGetFieldValueEmpty() {
|
||||
assertNull(ingestDocument.getFieldValue("", String.class));
|
||||
}
|
||||
|
||||
public void testHasProperty() {
|
||||
assertTrue(ingestDocument.hasPropertyValue("fizz"));
|
||||
public void testHasFieldValue() {
|
||||
assertTrue(ingestDocument.hasFieldValue("fizz"));
|
||||
}
|
||||
|
||||
public void testHasPropertyValueNested() {
|
||||
assertTrue(ingestDocument.hasPropertyValue("fizz.buzz"));
|
||||
public void testHasFieldValueNested() {
|
||||
assertTrue(ingestDocument.hasFieldValue("fizz.buzz"));
|
||||
}
|
||||
|
||||
public void testHasPropertyValueNotFound() {
|
||||
assertFalse(ingestDocument.hasPropertyValue("doesnotexist"));
|
||||
public void testHasFieldValueNotFound() {
|
||||
assertFalse(ingestDocument.hasFieldValue("doesnotexist"));
|
||||
}
|
||||
|
||||
public void testHasPropertyValueNestedNotFound() {
|
||||
assertFalse(ingestDocument.hasPropertyValue("fizz.doesnotexist"));
|
||||
public void testHasFieldValueNestedNotFound() {
|
||||
assertFalse(ingestDocument.hasFieldValue("fizz.doesnotexist"));
|
||||
}
|
||||
|
||||
public void testHasPropertyValueNull() {
|
||||
assertFalse(ingestDocument.hasPropertyValue(null));
|
||||
public void testHasFieldValueNull() {
|
||||
assertFalse(ingestDocument.hasFieldValue(null));
|
||||
}
|
||||
|
||||
public void testHasPropertyValueNullValue() {
|
||||
assertTrue(ingestDocument.hasPropertyValue("fizz.foo_null"));
|
||||
public void testHasFieldValueNullValue() {
|
||||
assertTrue(ingestDocument.hasFieldValue("fizz.foo_null"));
|
||||
}
|
||||
|
||||
public void testHasPropertyValueEmpty() {
|
||||
assertFalse(ingestDocument.hasPropertyValue(""));
|
||||
public void testHasFieldValueEmpty() {
|
||||
assertFalse(ingestDocument.hasFieldValue(""));
|
||||
}
|
||||
|
||||
public void testSimpleSetPropertyValue() {
|
||||
ingestDocument.setPropertyValue("new_field", "foo");
|
||||
public void testSimpleSetFieldValue() {
|
||||
ingestDocument.setFieldValue("new_field", "foo");
|
||||
assertThat(ingestDocument.getSource().get("new_field"), equalTo("foo"));
|
||||
assertThat(ingestDocument.isModified(), equalTo(true));
|
||||
}
|
||||
|
||||
public void testSetPropertyValueNullValue() {
|
||||
ingestDocument.setPropertyValue("new_field", null);
|
||||
public void testSetFieldValueNullValue() {
|
||||
ingestDocument.setFieldValue("new_field", null);
|
||||
assertThat(ingestDocument.getSource().containsKey("new_field"), equalTo(true));
|
||||
assertThat(ingestDocument.getSource().get("new_field"), nullValue());
|
||||
assertThat(ingestDocument.isModified(), equalTo(true));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testNestedSetPropertyValue() {
|
||||
ingestDocument.setPropertyValue("a.b.c.d", "foo");
|
||||
public void testNestedSetFieldValue() {
|
||||
ingestDocument.setFieldValue("a.b.c.d", "foo");
|
||||
assertThat(ingestDocument.getSource().get("a"), instanceOf(Map.class));
|
||||
Map<String, Object> a = (Map<String, Object>) ingestDocument.getSource().get("a");
|
||||
assertThat(a.get("b"), instanceOf(Map.class));
|
||||
|
@ -141,14 +141,14 @@ public class IngestDocumentTests extends ESTestCase {
|
|||
assertThat(ingestDocument.isModified(), equalTo(true));
|
||||
}
|
||||
|
||||
public void testSetPropertyValueOnExistingField() {
|
||||
ingestDocument.setPropertyValue("foo", "newbar");
|
||||
public void testSetFieldValueOnExistingField() {
|
||||
ingestDocument.setFieldValue("foo", "newbar");
|
||||
assertThat(ingestDocument.getSource().get("foo"), equalTo("newbar"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testSetPropertyValueOnExistingParent() {
|
||||
ingestDocument.setPropertyValue("fizz.new", "bar");
|
||||
public void testSetFieldValueOnExistingParent() {
|
||||
ingestDocument.setFieldValue("fizz.new", "bar");
|
||||
assertThat(ingestDocument.getSource().get("fizz"), instanceOf(Map.class));
|
||||
Map<String, Object> innerMap = (Map<String, Object>) ingestDocument.getSource().get("fizz");
|
||||
assertThat(innerMap.get("new"), instanceOf(String.class));
|
||||
|
@ -157,9 +157,9 @@ public class IngestDocumentTests extends ESTestCase {
|
|||
assertThat(ingestDocument.isModified(), equalTo(true));
|
||||
}
|
||||
|
||||
public void testSetPropertyValueOnExistingParentTypeMismatch() {
|
||||
public void testSetFieldValueOnExistingParentTypeMismatch() {
|
||||
try {
|
||||
ingestDocument.setPropertyValue("fizz.buzz.new", "bar");
|
||||
ingestDocument.setFieldValue("fizz.buzz.new", "bar");
|
||||
fail("add field should have failed");
|
||||
} catch(IllegalArgumentException e) {
|
||||
assertThat(e.getMessage(), equalTo("cannot add field to parent [buzz] of type [java.lang.String], [java.util.Map] expected instead."));
|
||||
|
@ -167,9 +167,9 @@ public class IngestDocumentTests extends ESTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public void testSetPropertyValueOnExistingNullParent() {
|
||||
public void testSetFieldValueOnExistingNullParent() {
|
||||
try {
|
||||
ingestDocument.setPropertyValue("fizz.foo_null.test", "bar");
|
||||
ingestDocument.setFieldValue("fizz.foo_null.test", "bar");
|
||||
fail("add field should have failed");
|
||||
} catch(IllegalArgumentException e) {
|
||||
assertThat(e.getMessage(), equalTo("cannot add field to null parent, [java.util.Map] expected instead."));
|
||||
|
@ -177,9 +177,9 @@ public class IngestDocumentTests extends ESTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public void testSetPropertyValueNullName() {
|
||||
public void testSetFieldValueNullName() {
|
||||
try {
|
||||
ingestDocument.setPropertyValue(null, "bar");
|
||||
ingestDocument.setFieldValue(null, "bar");
|
||||
fail("add field should have failed");
|
||||
} catch(IllegalArgumentException e) {
|
||||
assertThat(e.getMessage(), equalTo("cannot add null or empty field"));
|
||||
|
@ -187,9 +187,9 @@ public class IngestDocumentTests extends ESTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public void testSetPropertyValueEmptyName() {
|
||||
public void testSetFieldValueEmptyName() {
|
||||
try {
|
||||
ingestDocument.setPropertyValue("", "bar");
|
||||
ingestDocument.setFieldValue("", "bar");
|
||||
fail("add field should have failed");
|
||||
} catch(IllegalArgumentException e) {
|
||||
assertThat(e.getMessage(), equalTo("cannot add null or empty field"));
|
||||
|
@ -197,15 +197,15 @@ public class IngestDocumentTests extends ESTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public void testRemoveProperty() {
|
||||
ingestDocument.removeProperty("foo");
|
||||
public void testRemoveField() {
|
||||
ingestDocument.removeField("foo");
|
||||
assertThat(ingestDocument.isModified(), equalTo(true));
|
||||
assertThat(ingestDocument.getSource().size(), equalTo(2));
|
||||
assertThat(ingestDocument.getSource().containsKey("foo"), equalTo(false));
|
||||
}
|
||||
|
||||
public void testRemoveInnerProperty() {
|
||||
ingestDocument.removeProperty("fizz.buzz");
|
||||
public void testRemoveInnerField() {
|
||||
ingestDocument.removeField("fizz.buzz");
|
||||
assertThat(ingestDocument.getSource().size(), equalTo(3));
|
||||
assertThat(ingestDocument.getSource().get("fizz"), instanceOf(Map.class));
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -213,33 +213,33 @@ public class IngestDocumentTests extends ESTestCase {
|
|||
assertThat(map.size(), equalTo(1));
|
||||
assertThat(map.containsKey("buzz"), equalTo(false));
|
||||
|
||||
ingestDocument.removeProperty("fizz.foo_null");
|
||||
ingestDocument.removeField("fizz.foo_null");
|
||||
assertThat(map.size(), equalTo(0));
|
||||
assertThat(ingestDocument.getSource().size(), equalTo(3));
|
||||
assertThat(ingestDocument.getSource().containsKey("fizz"), equalTo(true));
|
||||
assertThat(ingestDocument.isModified(), equalTo(true));
|
||||
}
|
||||
|
||||
public void testRemoveNonExistingProperty() {
|
||||
ingestDocument.removeProperty("does_not_exist");
|
||||
public void testRemoveNonExistingField() {
|
||||
ingestDocument.removeField("does_not_exist");
|
||||
assertThat(ingestDocument.isModified(), equalTo(false));
|
||||
assertThat(ingestDocument.getSource().size(), equalTo(3));
|
||||
}
|
||||
|
||||
public void testRemoveExistingParentTypeMismatch() {
|
||||
ingestDocument.removeProperty("foo.test");
|
||||
ingestDocument.removeField("foo.test");
|
||||
assertThat(ingestDocument.isModified(), equalTo(false));
|
||||
assertThat(ingestDocument.getSource().size(), equalTo(3));
|
||||
}
|
||||
|
||||
public void testRemoveNullProperty() {
|
||||
ingestDocument.removeProperty(null);
|
||||
public void testRemoveNullField() {
|
||||
ingestDocument.removeField(null);
|
||||
assertThat(ingestDocument.isModified(), equalTo(false));
|
||||
assertThat(ingestDocument.getSource().size(), equalTo(3));
|
||||
}
|
||||
|
||||
public void testRemoveEmptyProperty() {
|
||||
ingestDocument.removeProperty("");
|
||||
public void testRemoveEmptyField() {
|
||||
ingestDocument.removeField("");
|
||||
assertThat(ingestDocument.isModified(), equalTo(false));
|
||||
assertThat(ingestDocument.getSource().size(), equalTo(3));
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public final class RandomDocumentPicks {
|
|||
randomEntry = RandomPicks.randomFrom(random, treeMap.entrySet());
|
||||
key += "." + randomEntry.getKey();
|
||||
}
|
||||
assert ingestDocument.getPropertyValue(key, Object.class) != null;
|
||||
assert ingestDocument.getFieldValue(key, Object.class) != null;
|
||||
return key;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ public final class RandomDocumentPicks {
|
|||
do {
|
||||
fieldName = randomFieldName(random);
|
||||
} while (canAddField(fieldName, ingestDocument) == false);
|
||||
ingestDocument.setPropertyValue(fieldName, value);
|
||||
ingestDocument.setFieldValue(fieldName, value);
|
||||
return fieldName;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public abstract class AbstractStringProcessorTestCase extends ESTestCase {
|
|||
Processor processor = newProcessor(expected.keySet());
|
||||
processor.execute(ingestDocument);
|
||||
for (Map.Entry<String, String> entry : expected.entrySet()) {
|
||||
assertThat(ingestDocument.getPropertyValue(entry.getKey(), String.class), equalTo(entry.getValue()));
|
||||
assertThat(ingestDocument.getFieldValue(entry.getKey(), String.class), equalTo(entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ public abstract class AbstractStringProcessorTestCase extends ESTestCase {
|
|||
String fieldName = RandomDocumentPicks.randomFieldName(random());
|
||||
Processor processor = newProcessor(Collections.singletonList(fieldName));
|
||||
IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());
|
||||
ingestDocument.setPropertyValue(fieldName, randomInt());
|
||||
ingestDocument.setFieldValue(fieldName, randomInt());
|
||||
try {
|
||||
processor.execute(ingestDocument);
|
||||
fail("processor should have failed");
|
||||
|
|
|
@ -44,8 +44,8 @@ public class AddProcessorTests extends ESTestCase {
|
|||
processor.execute(ingestDocument);
|
||||
|
||||
for (Map.Entry<String, Object> field : fields.entrySet()) {
|
||||
assertThat(ingestDocument.hasPropertyValue(field.getKey()), equalTo(true));
|
||||
assertThat(ingestDocument.getPropertyValue(field.getKey(), Object.class), equalTo(field.getValue()));
|
||||
assertThat(ingestDocument.hasFieldValue(field.getKey()), equalTo(true));
|
||||
assertThat(ingestDocument.getFieldValue(field.getKey(), Object.class), equalTo(field.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,14 +63,14 @@ public class AddProcessorTests extends ESTestCase {
|
|||
Processor processor = new AddProcessor(fields);
|
||||
processor.execute(ingestDocument);
|
||||
for (Map.Entry<String, Object> field : fields.entrySet()) {
|
||||
assertThat(ingestDocument.hasPropertyValue(field.getKey()), equalTo(true));
|
||||
assertThat(ingestDocument.getPropertyValue(field.getKey(), Object.class), equalTo(field.getValue()));
|
||||
assertThat(ingestDocument.hasFieldValue(field.getKey()), equalTo(true));
|
||||
assertThat(ingestDocument.getFieldValue(field.getKey(), Object.class), equalTo(field.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
public void testAddFieldsTypeMismatch() throws IOException {
|
||||
IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());
|
||||
ingestDocument.setPropertyValue("field", "value");
|
||||
ingestDocument.setFieldValue("field", "value");
|
||||
Processor processor = new AddProcessor(Collections.singletonMap("field.inner", "value"));
|
||||
try {
|
||||
processor.execute(ingestDocument);
|
||||
|
|
|
@ -46,7 +46,7 @@ public class ConvertProcessorTests extends ESTestCase {
|
|||
Processor processor = new ConvertProcessor(fields);
|
||||
processor.execute(ingestDocument);
|
||||
for (Map.Entry<String, Integer> entry : expectedResult.entrySet()) {
|
||||
assertThat(ingestDocument.getPropertyValue(entry.getKey(), Integer.class), equalTo(entry.getValue()));
|
||||
assertThat(ingestDocument.getFieldValue(entry.getKey(), Integer.class), equalTo(entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class ConvertProcessorTests extends ESTestCase {
|
|||
Processor processor = new ConvertProcessor(fields);
|
||||
processor.execute(ingestDocument);
|
||||
for (Map.Entry<String, List<Integer>> entry : expectedResult.entrySet()) {
|
||||
assertThat(ingestDocument.getPropertyValue(entry.getKey(), List.class), equalTo(entry.getValue()));
|
||||
assertThat(ingestDocument.getFieldValue(entry.getKey(), List.class), equalTo(entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class ConvertProcessorTests extends ESTestCase {
|
|||
IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());
|
||||
String fieldName = RandomDocumentPicks.randomFieldName(random());
|
||||
String value = "string-" + randomAsciiOfLengthBetween(1, 10);
|
||||
ingestDocument.setPropertyValue(fieldName, value);
|
||||
ingestDocument.setFieldValue(fieldName, value);
|
||||
|
||||
Map<String, Type> convert = Collections.singletonMap(fieldName, Type.INTEGER);
|
||||
Processor processor = new ConvertProcessor(convert);
|
||||
|
@ -106,7 +106,7 @@ public class ConvertProcessorTests extends ESTestCase {
|
|||
Processor processor = new ConvertProcessor(fields);
|
||||
processor.execute(ingestDocument);
|
||||
for (Map.Entry<String, Float> entry : expectedResult.entrySet()) {
|
||||
assertThat(ingestDocument.getPropertyValue(entry.getKey(), Float.class), equalTo(entry.getValue()));
|
||||
assertThat(ingestDocument.getFieldValue(entry.getKey(), Float.class), equalTo(entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ public class ConvertProcessorTests extends ESTestCase {
|
|||
Processor processor = new ConvertProcessor(fields);
|
||||
processor.execute(ingestDocument);
|
||||
for (Map.Entry<String, List<Float>> entry : expectedResult.entrySet()) {
|
||||
assertThat(ingestDocument.getPropertyValue(entry.getKey(), List.class), equalTo(entry.getValue()));
|
||||
assertThat(ingestDocument.getFieldValue(entry.getKey(), List.class), equalTo(entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ public class ConvertProcessorTests extends ESTestCase {
|
|||
IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());
|
||||
String fieldName = RandomDocumentPicks.randomFieldName(random());
|
||||
String value = "string-" + randomAsciiOfLengthBetween(1, 10);
|
||||
ingestDocument.setPropertyValue(fieldName, value);
|
||||
ingestDocument.setFieldValue(fieldName, value);
|
||||
|
||||
Map<String, Type> convert = Collections.singletonMap(fieldName, Type.FLOAT);
|
||||
Processor processor = new ConvertProcessor(convert);
|
||||
|
@ -170,7 +170,7 @@ public class ConvertProcessorTests extends ESTestCase {
|
|||
Processor processor = new ConvertProcessor(fields);
|
||||
processor.execute(ingestDocument);
|
||||
for (Map.Entry<String, Boolean> entry : expectedResult.entrySet()) {
|
||||
assertThat(ingestDocument.getPropertyValue(entry.getKey(), Boolean.class), equalTo(entry.getValue()));
|
||||
assertThat(ingestDocument.getFieldValue(entry.getKey(), Boolean.class), equalTo(entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ public class ConvertProcessorTests extends ESTestCase {
|
|||
Processor processor = new ConvertProcessor(fields);
|
||||
processor.execute(ingestDocument);
|
||||
for (Map.Entry<String, List<Boolean>> entry : expectedResult.entrySet()) {
|
||||
assertThat(ingestDocument.getPropertyValue(entry.getKey(), List.class), equalTo(entry.getValue()));
|
||||
assertThat(ingestDocument.getFieldValue(entry.getKey(), List.class), equalTo(entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ public class ConvertProcessorTests extends ESTestCase {
|
|||
//verify that only proper boolean values are supported and we are strict about it
|
||||
fieldValue = randomFrom("on", "off", "yes", "no", "0", "1");
|
||||
}
|
||||
ingestDocument.setPropertyValue(fieldName, fieldValue);
|
||||
ingestDocument.setFieldValue(fieldName, fieldValue);
|
||||
|
||||
Map<String, Type> convert = Collections.singletonMap(fieldName, Type.BOOLEAN);
|
||||
Processor processor = new ConvertProcessor(convert);
|
||||
|
@ -260,7 +260,7 @@ public class ConvertProcessorTests extends ESTestCase {
|
|||
Processor processor = new ConvertProcessor(fields);
|
||||
processor.execute(ingestDocument);
|
||||
for (Map.Entry<String, String> entry : expectedResult.entrySet()) {
|
||||
assertThat(ingestDocument.getPropertyValue(entry.getKey(), String.class), equalTo(entry.getValue()));
|
||||
assertThat(ingestDocument.getFieldValue(entry.getKey(), String.class), equalTo(entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -305,7 +305,7 @@ public class ConvertProcessorTests extends ESTestCase {
|
|||
Processor processor = new ConvertProcessor(fields);
|
||||
processor.execute(ingestDocument);
|
||||
for (Map.Entry<String, List<String>> entry : expectedResult.entrySet()) {
|
||||
assertThat(ingestDocument.getPropertyValue(entry.getKey(), List.class), equalTo(entry.getValue()));
|
||||
assertThat(ingestDocument.getFieldValue(entry.getKey(), List.class), equalTo(entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ public class DateProcessorTests extends ESTestCase {
|
|||
document.put("date_as_string", "2010 12 06 11:05:15");
|
||||
IngestDocument ingestDocument = new IngestDocument("index", "type", "id", document);
|
||||
dateProcessor.execute(ingestDocument);
|
||||
assertThat(ingestDocument.getPropertyValue("date_as_date", String.class), equalTo("2010-06-12T11:05:15.000+02:00"));
|
||||
assertThat(ingestDocument.getFieldValue("date_as_date", String.class), equalTo("2010-06-12T11:05:15.000+02:00"));
|
||||
}
|
||||
|
||||
public void testJodaPatternMultipleFormats() {
|
||||
|
@ -53,19 +53,19 @@ public class DateProcessorTests extends ESTestCase {
|
|||
document.put("date_as_string", "2010 12 06");
|
||||
IngestDocument ingestDocument = new IngestDocument("index", "type", "id", document);
|
||||
dateProcessor.execute(ingestDocument);
|
||||
assertThat(ingestDocument.getPropertyValue("date_as_date", String.class), equalTo("2010-06-12T00:00:00.000+02:00"));
|
||||
assertThat(ingestDocument.getFieldValue("date_as_date", String.class), equalTo("2010-06-12T00:00:00.000+02:00"));
|
||||
|
||||
document = new HashMap<>();
|
||||
document.put("date_as_string", "12/06/2010");
|
||||
ingestDocument = new IngestDocument("index", "type", "id", document);
|
||||
dateProcessor.execute(ingestDocument);
|
||||
assertThat(ingestDocument.getPropertyValue("date_as_date", String.class), equalTo("2010-06-12T00:00:00.000+02:00"));
|
||||
assertThat(ingestDocument.getFieldValue("date_as_date", String.class), equalTo("2010-06-12T00:00:00.000+02:00"));
|
||||
|
||||
document = new HashMap<>();
|
||||
document.put("date_as_string", "12-06-2010");
|
||||
ingestDocument = new IngestDocument("index", "type", "id", document);
|
||||
dateProcessor.execute(ingestDocument);
|
||||
assertThat(ingestDocument.getPropertyValue("date_as_date", String.class), equalTo("2010-06-12T00:00:00.000+02:00"));
|
||||
assertThat(ingestDocument.getFieldValue("date_as_date", String.class), equalTo("2010-06-12T00:00:00.000+02:00"));
|
||||
|
||||
document = new HashMap<>();
|
||||
document.put("date_as_string", "2010");
|
||||
|
@ -85,7 +85,7 @@ public class DateProcessorTests extends ESTestCase {
|
|||
document.put("date_as_string", "2010 12 giugno");
|
||||
IngestDocument ingestDocument = new IngestDocument("index", "type", "id", document);
|
||||
dateProcessor.execute(ingestDocument);
|
||||
assertThat(ingestDocument.getPropertyValue("date_as_date", String.class), equalTo("2010-06-12T00:00:00.000+02:00"));
|
||||
assertThat(ingestDocument.getFieldValue("date_as_date", String.class), equalTo("2010-06-12T00:00:00.000+02:00"));
|
||||
}
|
||||
|
||||
public void testJodaPatternDefaultYear() {
|
||||
|
@ -95,7 +95,7 @@ public class DateProcessorTests extends ESTestCase {
|
|||
document.put("date_as_string", "12/06");
|
||||
IngestDocument ingestDocument = new IngestDocument("index", "type", "id", document);
|
||||
dateProcessor.execute(ingestDocument);
|
||||
assertThat(ingestDocument.getPropertyValue("date_as_date", String.class), equalTo(DateTime.now().getYear() + "-06-12T00:00:00.000+02:00"));
|
||||
assertThat(ingestDocument.getFieldValue("date_as_date", String.class), equalTo(DateTime.now().getYear() + "-06-12T00:00:00.000+02:00"));
|
||||
}
|
||||
|
||||
public void testTAI64N() {
|
||||
|
@ -106,7 +106,7 @@ public class DateProcessorTests extends ESTestCase {
|
|||
document.put("date_as_string", dateAsString);
|
||||
IngestDocument ingestDocument = new IngestDocument("index", "type", "id", document);
|
||||
dateProcessor.execute(ingestDocument);
|
||||
assertThat(ingestDocument.getPropertyValue("date_as_date", String.class), equalTo("2012-12-22T03:00:46.767+02:00"));
|
||||
assertThat(ingestDocument.getFieldValue("date_as_date", String.class), equalTo("2012-12-22T03:00:46.767+02:00"));
|
||||
}
|
||||
|
||||
public void testUnixMs() {
|
||||
|
@ -116,7 +116,7 @@ public class DateProcessorTests extends ESTestCase {
|
|||
document.put("date_as_string", "1000500");
|
||||
IngestDocument ingestDocument = new IngestDocument("index", "type", "id", document);
|
||||
dateProcessor.execute(ingestDocument);
|
||||
assertThat(ingestDocument.getPropertyValue("date_as_date", String.class), equalTo("1970-01-01T00:16:40.500Z"));
|
||||
assertThat(ingestDocument.getFieldValue("date_as_date", String.class), equalTo("1970-01-01T00:16:40.500Z"));
|
||||
}
|
||||
|
||||
public void testUnix() {
|
||||
|
@ -126,6 +126,6 @@ public class DateProcessorTests extends ESTestCase {
|
|||
document.put("date_as_string", "1000.5");
|
||||
IngestDocument ingestDocument = new IngestDocument("index", "type", "id", document);
|
||||
dateProcessor.execute(ingestDocument);
|
||||
assertThat(ingestDocument.getPropertyValue("date_as_date", String.class), equalTo("1970-01-01T00:16:40.500Z"));
|
||||
assertThat(ingestDocument.getFieldValue("date_as_date", String.class), equalTo("1970-01-01T00:16:40.500Z"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,14 +46,14 @@ public class GsubProcessorTests extends ESTestCase {
|
|||
Processor processor = new GsubProcessor(expressions);
|
||||
processor.execute(ingestDocument);
|
||||
for (GsubExpression expression : expressions) {
|
||||
assertThat(ingestDocument.getPropertyValue(expression.getFieldName(), String.class), equalTo("127-0-0-1"));
|
||||
assertThat(ingestDocument.getFieldValue(expression.getFieldName(), String.class), equalTo("127-0-0-1"));
|
||||
}
|
||||
}
|
||||
|
||||
public void testGsubNotAStringValue() throws IOException {
|
||||
IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());
|
||||
String fieldName = RandomDocumentPicks.randomFieldName(random());
|
||||
ingestDocument.setPropertyValue(fieldName, 123);
|
||||
ingestDocument.setFieldValue(fieldName, 123);
|
||||
List<GsubExpression> gsubExpressions = Collections.singletonList(new GsubExpression(fieldName, Pattern.compile("\\."), "-"));
|
||||
Processor processor = new GsubProcessor(gsubExpressions);
|
||||
try {
|
||||
|
|
|
@ -58,7 +58,7 @@ public class JoinProcessorTests extends ESTestCase {
|
|||
Processor processor = new JoinProcessor(fields);
|
||||
processor.execute(ingestDocument);
|
||||
for (Map.Entry<String, String> entry : expectedResultMap.entrySet()) {
|
||||
assertThat(ingestDocument.getPropertyValue(entry.getKey(), String.class), equalTo(entry.getValue()));
|
||||
assertThat(ingestDocument.getFieldValue(entry.getKey(), String.class), equalTo(entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,14 +87,14 @@ public class JoinProcessorTests extends ESTestCase {
|
|||
Processor processor = new JoinProcessor(fields);
|
||||
processor.execute(ingestDocument);
|
||||
for (Map.Entry<String, String> entry : expectedResultMap.entrySet()) {
|
||||
assertThat(ingestDocument.getPropertyValue(entry.getKey(), String.class), equalTo(entry.getValue()));
|
||||
assertThat(ingestDocument.getFieldValue(entry.getKey(), String.class), equalTo(entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
public void testJoinNonListField() throws IOException {
|
||||
IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());
|
||||
String fieldName = RandomDocumentPicks.randomFieldName(random());
|
||||
ingestDocument.setPropertyValue(fieldName, randomAsciiOfLengthBetween(1, 10));
|
||||
ingestDocument.setFieldValue(fieldName, randomAsciiOfLengthBetween(1, 10));
|
||||
Map<String, String> join = Collections.singletonMap(fieldName, "-");
|
||||
Processor processor = new JoinProcessor(join);
|
||||
try {
|
||||
|
|
|
@ -45,8 +45,8 @@ public class RemoveProcessorTests extends ESTestCase {
|
|||
Processor processor = new RemoveProcessor(fields);
|
||||
processor.execute(ingestDocument);
|
||||
for (String field : fields) {
|
||||
assertThat(ingestDocument.getPropertyValue(field, Object.class), nullValue());
|
||||
assertThat(ingestDocument.hasPropertyValue(field), equalTo(false));
|
||||
assertThat(ingestDocument.getFieldValue(field, Object.class), nullValue());
|
||||
assertThat(ingestDocument.hasFieldValue(field), equalTo(false));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,13 +46,13 @@ public class RenameProcessorTests extends ESTestCase {
|
|||
do {
|
||||
newFieldName = RandomDocumentPicks.randomFieldName(random());
|
||||
} while (RandomDocumentPicks.canAddField(newFieldName, ingestDocument) == false || newFields.containsKey(newFieldName));
|
||||
newFields.put(newFieldName, ingestDocument.getPropertyValue(fieldName, Object.class));
|
||||
newFields.put(newFieldName, ingestDocument.getFieldValue(fieldName, Object.class));
|
||||
fields.put(fieldName, newFieldName);
|
||||
}
|
||||
Processor processor = new RenameProcessor(fields);
|
||||
processor.execute(ingestDocument);
|
||||
for (Map.Entry<String, Object> entry : newFields.entrySet()) {
|
||||
assertThat(ingestDocument.getPropertyValue(entry.getKey(), Object.class), equalTo(entry.getValue()));
|
||||
assertThat(ingestDocument.getFieldValue(entry.getKey(), Object.class), equalTo(entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,12 +66,12 @@ public class RenameProcessorTests extends ESTestCase {
|
|||
public void testRenameExistingFieldNullValue() throws IOException {
|
||||
IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());
|
||||
String fieldName = RandomDocumentPicks.randomFieldName(random());
|
||||
ingestDocument.setPropertyValue(fieldName, null);
|
||||
ingestDocument.setFieldValue(fieldName, null);
|
||||
String newFieldName = RandomDocumentPicks.randomFieldName(random());
|
||||
Processor processor = new RenameProcessor(Collections.singletonMap(fieldName, newFieldName));
|
||||
processor.execute(ingestDocument);
|
||||
assertThat(ingestDocument.hasPropertyValue(fieldName), equalTo(false));
|
||||
assertThat(ingestDocument.hasPropertyValue(newFieldName), equalTo(true));
|
||||
assertThat(ingestDocument.getPropertyValue(newFieldName, Object.class), nullValue());
|
||||
assertThat(ingestDocument.hasFieldValue(fieldName), equalTo(false));
|
||||
assertThat(ingestDocument.hasFieldValue(newFieldName), equalTo(true));
|
||||
assertThat(ingestDocument.getFieldValue(newFieldName, Object.class), nullValue());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class SplitProcessorTests extends ESTestCase {
|
|||
Processor processor = new SplitProcessor(fields);
|
||||
processor.execute(ingestDocument);
|
||||
for (String field : fields.keySet()) {
|
||||
assertThat(ingestDocument.getPropertyValue(field, List.class), equalTo(Arrays.asList("127", "0", "0", "1")));
|
||||
assertThat(ingestDocument.getFieldValue(field, List.class), equalTo(Arrays.asList("127", "0", "0", "1")));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class SplitProcessorTests extends ESTestCase {
|
|||
public void testSplitNonStringValue() throws IOException {
|
||||
IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());
|
||||
String fieldName = RandomDocumentPicks.randomFieldName(random());
|
||||
ingestDocument.setPropertyValue(fieldName, randomInt());
|
||||
ingestDocument.setFieldValue(fieldName, randomInt());
|
||||
Processor processor = new SplitProcessor(Collections.singletonMap(fieldName, "\\."));
|
||||
try {
|
||||
processor.execute(ingestDocument);
|
||||
|
|
|
@ -174,7 +174,7 @@ public class IngestActionFilterTests extends ESTestCase {
|
|||
Processor processor = new Processor() {
|
||||
@Override
|
||||
public void execute(IngestDocument ingestDocument) {
|
||||
ingestDocument.setPropertyValue("field2", "value2");
|
||||
ingestDocument.setFieldValue("field2", "value2");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue