diff --git a/adapter-http/src/main/java/io/nosqlbench/adapter/http/core/HttpOpDispenser.java b/adapter-http/src/main/java/io/nosqlbench/adapter/http/core/HttpOpDispenser.java index 0de375824..6895a18b7 100644 --- a/adapter-http/src/main/java/io/nosqlbench/adapter/http/core/HttpOpDispenser.java +++ b/adapter-http/src/main/java/io/nosqlbench/adapter/http/core/HttpOpDispenser.java @@ -46,9 +46,10 @@ public class HttpOpDispenser extends BaseOpDispenser { LongFunction builderF = l -> HttpRequest.newBuilder(); LongFunction bodyF = op.getAsFunctionOr("body", null); LongFunction bodyPublisherF = - l -> Optional.ofNullable(bodyF.apply(l)).map(HttpRequest.BodyPublishers::ofString).orElse( - HttpRequest.BodyPublishers.noBody() - ); + l -> Optional.ofNullable(bodyF.apply(l)) + .map(s -> s + "\n") // the elastic _bulk endpoint requires a newline at the end of the body + .map(HttpRequest.BodyPublishers::ofString) + .orElse(HttpRequest.BodyPublishers.noBody()); LongFunction methodF = op.getAsFunctionOr("method", "GET"); LongFunction initBuilderF =