diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/StorageEsInstaller.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/StorageEsInstaller.java index 2a131601e..143d095bd 100644 --- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/StorageEsInstaller.java +++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/StorageEsInstaller.java @@ -53,11 +53,12 @@ public class StorageEsInstaller extends ModelInstaller { protected boolean isExists(Model model) throws StorageException { ElasticSearchClient esClient = (ElasticSearchClient) client; try { - String timeSeriesIndexName = - model.isTimeSeries() ? - TimeSeriesUtils.latestWriteIndexName(model) : - model.getName(); - return esClient.isExistsTemplate(model.getName()) && esClient.isExistsIndex(timeSeriesIndexName); + if (model.isTimeSeries()) { + return esClient.isExistsTemplate(model.getName()) && esClient.isExistsIndex( + TimeSeriesUtils.latestWriteIndexName(model)); + } else { + return esClient.isExistsIndex(model.getName()); + } } catch (IOException e) { throw new StorageException(e.getMessage()); }