From 5ea18f39b572b9c552ed066f32be08f14384452d Mon Sep 17 00:00:00 2001 From: Koji Kawamura Date: Thu, 26 Nov 2020 16:26:45 +0900 Subject: [PATCH] NIFI-8048 PutElasticsearchRecord should retry with 503 response Signed-off-by: Pierre Villard This closes #4690. --- .../org/apache/nifi/elasticsearch/ElasticsearchError.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/ElasticsearchError.java b/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/ElasticsearchError.java index c383c8d41d..0973567abe 100644 --- a/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/ElasticsearchError.java +++ b/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/ElasticsearchError.java @@ -36,7 +36,10 @@ public class ElasticsearchError extends RuntimeException { public ElasticsearchError(Exception ex) { super(ex); - isElastic = ELASTIC_ERROR_NAMES.contains(ex.getClass().getSimpleName()); + final boolean isKnownException = ELASTIC_ERROR_NAMES.contains(ex.getClass().getSimpleName()); + final boolean isServiceUnavailable = "ResponseException".equals(ex.getClass().getSimpleName()) + && ex.getMessage().contains("503 Service Unavailable"); + isElastic = isKnownException || isServiceUnavailable; } public boolean isElastic() {