diff --git a/arlas-core/src/main/java/io/arlas/server/core/impl/elastic/utils/ElasticClient.java b/arlas-core/src/main/java/io/arlas/server/core/impl/elastic/utils/ElasticClient.java index 545851d7d..5abf402f4 100644 --- a/arlas-core/src/main/java/io/arlas/server/core/impl/elastic/utils/ElasticClient.java +++ b/arlas-core/src/main/java/io/arlas/server/core/impl/elastic/utils/ElasticClient.java @@ -275,7 +275,7 @@ public Map> getMappings(String index) throws ArlasEx return res; } catch (IOException | ElasticsearchException e) { processException(e, index); - return null; + return Map.of(); } } @@ -384,9 +384,11 @@ public CollectionReference getCollectionReferenceFromES(String index, String ref } private void processException(Exception e, String index) throws ArlasException { - if (e instanceof ResponseException) { - if (((ResponseException) e).getResponse().getStatusLine().getStatusCode() == 404) { - throw new NotFoundException("Index " + index + " does not exist."); + if (e instanceof ElasticsearchException exception) { + if (exception.response().error().type().equals("index_not_found_exception")) { + LOGGER.warn("Index {} does not exist.", index); + // We do not raise exception anymore, silent error in case of index_not_found_exception in ES + return; } } LOGGER.warn("Exception while communicating with ES: " + e.getMessage(), e);