diff --git a/plugin/trino-elasticsearch/src/main/java/io/trino/plugin/elasticsearch/client/ElasticsearchClient.java b/plugin/trino-elasticsearch/src/main/java/io/trino/plugin/elasticsearch/client/ElasticsearchClient.java index 58996e17a12e..4725bf560d37 100644 --- a/plugin/trino-elasticsearch/src/main/java/io/trino/plugin/elasticsearch/client/ElasticsearchClient.java +++ b/plugin/trino-elasticsearch/src/main/java/io/trino/plugin/elasticsearch/client/ElasticsearchClient.java @@ -399,6 +399,9 @@ public List getIndexes() if (e.getErrorCode().equals(ELASTICSEARCH_INVALID_METADATA.toErrorCode())) { continue; } + if (e.getCause() instanceof ResponseException cause && cause.getResponse().getStatusLine().getStatusCode() == 404) { + continue; + } throw e; } } diff --git a/plugin/trino-opensearch/src/main/java/io/trino/plugin/opensearch/client/OpenSearchClient.java b/plugin/trino-opensearch/src/main/java/io/trino/plugin/opensearch/client/OpenSearchClient.java index 4cce5c4f939e..9e88fc87d678 100644 --- a/plugin/trino-opensearch/src/main/java/io/trino/plugin/opensearch/client/OpenSearchClient.java +++ b/plugin/trino-opensearch/src/main/java/io/trino/plugin/opensearch/client/OpenSearchClient.java @@ -400,6 +400,9 @@ public List getIndexes() if (e.getErrorCode().equals(OPENSEARCH_INVALID_METADATA.toErrorCode())) { continue; } + if (e.getCause() instanceof ResponseException cause && cause.getResponse().getStatusLine().getStatusCode() == 404) { + continue; + } throw e; } }