Skip to content

Commit 1675b1f

Browse files
committed
Verify an invariant
This arity of setFieldValue doesn't handle the single-value ignore_empty_value case (like in a set processor), it only handles the multi-value ignore_empty_values case (like in an append processor). The same thing applies to allow_duplicates, that is also an append-only concern.
1 parent bea6446 commit 1675b1f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/src/main/java/org/elasticsearch/ingest/IngestDocument.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ public void appendFieldValue(String path, ValueSource valueSource, boolean allow
688688
* item identified by the provided path.
689689
*/
690690
public void setFieldValue(String path, Object value) {
691-
setFieldValue(path, value, false, true, false);
691+
setFieldValue(path, value, false, false, false);
692692
}
693693

694694
/**
@@ -746,6 +746,8 @@ public void setFieldValue(String path, Object value, boolean ignoreEmptyValue) {
746746
}
747747

748748
private void setFieldValue(String path, Object value, boolean append, boolean allowDuplicates, boolean ignoreEmptyValues) {
749+
assert append || (allowDuplicates == false && ignoreEmptyValues == false)
750+
: "allowDuplicates and ignoreEmptyValues only apply if append is true";
749751
final FieldPath fieldPath = FieldPath.of(path);
750752
Object context = fieldPath.initialContext(this);
751753
int leafKeyIndex = fieldPath.pathElements.length - 1;

0 commit comments

Comments
 (0)