diff --git a/modules/parent-join/src/main/java/org/elasticsearch/join/query/HasChildQueryBuilder.java b/modules/parent-join/src/main/java/org/elasticsearch/join/query/HasChildQueryBuilder.java index 1c44daea4e982..6df9f22a45298 100644 --- a/modules/parent-join/src/main/java/org/elasticsearch/join/query/HasChildQueryBuilder.java +++ b/modules/parent-join/src/main/java/org/elasticsearch/join/query/HasChildQueryBuilder.java @@ -66,7 +66,7 @@ public class HasChildQueryBuilder extends AbstractQueryBuilder foo.minMaxChildren(randomIntBetween(Integer.MIN_VALUE, -1), positiveValue)); - assertEquals("[has_child] requires non-negative 'min_children' field", e.getMessage()); + assertEquals("[has_child] requires non-negative, non-zero 'min_children' field", e.getMessage()); + + e = expectThrows(IllegalArgumentException.class, () -> foo.minMaxChildren(0, positiveValue)); + assertEquals("[has_child] requires non-negative, non-zero 'min_children' field", e.getMessage()); e = expectThrows(IllegalArgumentException.class, () -> foo.minMaxChildren(positiveValue, randomIntBetween(Integer.MIN_VALUE, -1))); assertEquals("[has_child] requires non-negative 'max_children' field", e.getMessage());