From 58854af662505ae35743ab82b6d64c7576c6bd76 Mon Sep 17 00:00:00 2001 From: Gao Hongtao Date: Thu, 8 Apr 2021 11:19:00 +0800 Subject: [PATCH] Fix slash root issues in es7 client (#6707) Signed-off-by: Gao Hongtao --- CHANGES.md | 2 +- .../plugin/elasticsearch7/client/ElasticSearch7Client.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index f21b92d44..989dc3812 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -74,7 +74,7 @@ Release Notes. * Make the flushing metrics operation concurrent. * Fix ALS K8SServiceRegistry didn't remove the correct entry. * Using "service.istio.io/canonical-name" to replace "app" label to resolve Envoy ALS service name. -* Append the root slash(/) to getIndex and getTemplate requests in ES client. +* Append the root slash(/) to getIndex and getTemplate requests in ES(6 and 7) client. * Fix `disable` statement not working. This bug exists since 8.0.0. * Remove the useless metric in `vm.yaml`. diff --git a/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/client/ElasticSearch7Client.java b/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/client/ElasticSearch7Client.java index f94ff092d..c0e0d72c3 100644 --- a/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/client/ElasticSearch7Client.java +++ b/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/client/ElasticSearch7Client.java @@ -175,7 +175,7 @@ public class ElasticSearch7Client extends ElasticSearchClient { indexName = formatIndexName(indexName); try { Response response = client.getLowLevelClient() - .performRequest(new Request(HttpGet.METHOD_NAME, indexName)); + .performRequest(new Request(HttpGet.METHOD_NAME, "/" + indexName)); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK) { healthChecker.health(); @@ -218,7 +218,7 @@ public class ElasticSearch7Client extends ElasticSearchClient { name = formatIndexName(name); try { Response response = client.getLowLevelClient() - .performRequest(new Request(HttpGet.METHOD_NAME, "_template/" + name)); + .performRequest(new Request(HttpGet.METHOD_NAME, "/_template/" + name)); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK) { healthChecker.health();