From ae7ef746aca053c555d40a651e77e7fe7a2ce5b3 Mon Sep 17 00:00:00 2001 From: Sylvain Wallez Date: Tue, 6 Aug 2024 11:07:52 +0200 Subject: [PATCH] Refine BooleanEndpoint so that 4xx status codes other than 404 are considered as errors (#853) --- .../elastic/clients/transport/endpoints/BooleanEndpoint.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java-client/src/main/java/co/elastic/clients/transport/endpoints/BooleanEndpoint.java b/java-client/src/main/java/co/elastic/clients/transport/endpoints/BooleanEndpoint.java index f2cbf967a..23e129823 100644 --- a/java-client/src/main/java/co/elastic/clients/transport/endpoints/BooleanEndpoint.java +++ b/java-client/src/main/java/co/elastic/clients/transport/endpoints/BooleanEndpoint.java @@ -41,7 +41,8 @@ public BooleanEndpoint( @Override public boolean isError(int statusCode) { - return statusCode >= 500; + // 404 indicates a 'false' result. + return statusCode != 404 && super.isError(statusCode); } public boolean getResult(int statusCode) {