From b8a040ea74e3197c3f693122f8ee3a33b444ef46 Mon Sep 17 00:00:00 2001 From: Gao Hongtao Date: Thu, 1 Apr 2021 14:26:57 +0800 Subject: [PATCH] Append the root slash(/) to getIndex and getTemplate requests in ES client (#6663) * Append the root slash(/) to getIndex and getTemplate requests Signed-off-by: Gao Hongtao * Document this bug Signed-off-by: Gao Hongtao --- CHANGES.md | 1 + .../library/client/elasticsearch/ElasticSearchClient.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index dc5441ebf..f7dedb545 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -65,6 +65,7 @@ Release Notes. * Add function `retagByK8sMeta` and opt type `K8sRetagType.Pod2Service` in MAL for k8s to relate pods and services. * 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 #### UI * Update selector scroller to show in all pages. diff --git a/oap-server/server-library/library-client/src/main/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ElasticSearchClient.java b/oap-server/server-library/library-client/src/main/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ElasticSearchClient.java index 9f215c3e9..503fa3064 100644 --- a/oap-server/server-library/library-client/src/main/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ElasticSearchClient.java +++ b/oap-server/server-library/library-client/src/main/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ElasticSearchClient.java @@ -234,7 +234,7 @@ public class ElasticSearchClient implements Client, HealthCheckable { indexName = formatIndexName(indexName); try { Response response = client.getLowLevelClient() - .performRequest(HttpGet.METHOD_NAME, indexName); + .performRequest(HttpGet.METHOD_NAME, "/" + indexName); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK) { healthChecker.health(); @@ -341,7 +341,7 @@ public class ElasticSearchClient implements Client, HealthCheckable { name = formatIndexName(name); try { Response response = client.getLowLevelClient() - .performRequest(HttpGet.METHOD_NAME, "_template/" + name); + .performRequest(HttpGet.METHOD_NAME, "/_template/" + name); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK) { healthChecker.health();